App wide feature flag manager. Manages the availability status of each features on the app utilizing the power of Firebase Remote Config.
Add Fire Flag to your pubspec.yaml file:
dependencies:
fire_flag: ^1.1.1
Add the required GoogleServiceInfo.plist
(for iOS) and google_services.json
(for Android) respectively to your project. See here for further read about adding Firebase configuration file.
Enable the Google services by configuring the Gradle scripts as such.
- Add the classpath to the
[project]/android/build.gradle
file.
dependencies {
// Example existing classpath
classpath 'com.android.tools.build:gradle:3.2.1'
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.0'
}
- Add the apply plugin to the
[project]/android/app/build.gradle
file.
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Note: If this section is not completed you will get an error like this:
java.lang.IllegalStateException:
Default FirebaseApp is not initialized in this process [package name].
Make sure to call FirebaseApp.initializeApp(Context) first.
Note: When you are debugging on android, use a device or AVD with Google Play services. Otherwise you will not be able to use Firebase Remote Config and Fire Flag.
Add the following imports to your Dart code:
import 'package:fire_flag/fire_flag.dart';
Initialize FireFlag
:
static final features = Features(features: [
Feature(
name: 'brandOverview', // Feature name, must be the same with the name on (Firebase Remote Config console)[https://console.firebase.google.com/].
isEnabled: false, // Feature status
),
]);
var fireFlag = FireFlag(
features: features
),
You can now subscribe to feature flag subscription stream to get the latest status of the feature.
Features featureFlag = features;
fireFlag
.featureFlagSubscription()
.listen((updatedFeatureFlag) {
featureFlag.value = updatedFeatureFlag;
});
See the example application source for a complete sample app using the Fire Flag.
Please file specific issues, bugs, or feature requests in our issue tracker.
To contribute a change to this plugin, open a pull request.