firebase_feature_flag 1.0.0
firebase_feature_flag: ^1.0.0 copied to clipboard
A Flutter package for managing feature flags using Firebase Realtime Database.
firebase_feature_flag #
A Flutter package for managing feature flags using Firebase Realtime Database.
Table of Contents #
Overview #
firebase_feature_flag
provides a convenient way to integrate feature flags into your Flutter app, allowing you to toggle features on and off remotely without requiring a new release. It utilizes Firebase Realtime Database to store and synchronize feature flag configurations.
Installation #
Add firebase_feature_flag
to your pubspec.yaml
file:
dependencies:
firebase_feature_flag: ^1.0.0
Run flutter pub get to install the package.
Usage #
1. Import the package #
import 'package:firebase_feature_flag/firebase_feature_flag.dart';
2. Initialize a FeatureFlag instance #
final FeatureFlag<bool> myFeatureFlag = FeatureFlag<bool>(
path: 'feature_flags/my_feature',
initialValue: true,
defaultValue: false,
);
3. Use FeatureFlagBuilder to conditionally display UI #
FeatureFlagBuilder<bool>(
feature: myFeatureFlag,
builder: (context, isEnabled) {
return isEnabled
? CustomWidget(message: 'Custom Widget is Enabled!')
: Text('Custom Widget is Disabled.');
},
onLoading: CircularProgressIndicator(),
),
Example #
Check the provided example in the example directory for a sample implementation.
Contributing #
Feel free to open issues and pull requests. Contributions are welcome!