Firebase remote config

From evanca/flutter-ai-rules · View interactive version

Firebase remote config is an AI agent skill from the GitHub repository evanca/flutter-ai-rules. Use when implementing feature flags, running A/B tests, setting parameter defaults, fetching/activating config, or enabling real-time config updates.

How to use this skill

Skill file

Firebase Remote Config Skill

This skill defines how to correctly use Firebase Remote Config in Flutter applications.

When to Use

Use this skill when:


1. Setup and Configuration

flutter pub add firebase_remote_config
flutter pub add firebase_analytics  # required for conditional targeting of app instances
import 'package:firebase_remote_config/firebase_remote_config.dart';

final remoteConfig = FirebaseRemoteConfig.instance;

Configure settings:

await remoteConfig.setConfigSettings(RemoteConfigSettings(
  fetchTimeout: const Duration(minutes: 1),
  minimumFetchInterval: const Duration(hours: 1),
));

2. Parameter Management

Set in-app defaults (ensures the app behaves as intended before connecting to the backend):

await remoteConfig.setDefaults(const {
  "feature_new_onboarding": false,
  "max_retry_attempts": 3,
  "welcome_message": "Hello, world!",
  "promo_discount_pct": 0.0,
});

Read values with type-specific getters:

final showNewOnboarding = remoteConfig.getBool("feature_new_onboarding");
final maxRetries = remoteConfig.getInt("max_retry_attempts");
final welcomeMsg = remoteConfig.getString("welcome_message");
final discount = remoteConfig.getDouble("promo_discount_pct");

3. Fetching and Activating

await remoteConfig.fetchAndActivate();

4. Real-time Updates

remoteConfig.onConfigUpdated.listen((event) async {
  await remoteConfig.activate();
  // event.updatedKeys contains the changed parameter names
  if (event.updatedKeys.contains("feature_new_onboarding")) {
    // Refresh UI based on the new value
  }
});

5. Throttling and Performance

await remoteConfig.setConfigSettings(RemoteConfigSettings(
  fetchTimeout: const Duration(minutes: 1),
  minimumFetchInterval: const Duration(minutes: 5),
));

6. Testing and Debugging


References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.