littlefish_config_launchdarkly 5.0.0
littlefish_config_launchdarkly: ^5.0.0 copied to clipboard
The littlefish implementation of our configuration service for launch darkly mobile
Littlefish Config LaunchDarkly #
A Flutter package for integrating LaunchDarkly with the Littlefish mobile application.
Features #
- Seamless integration with LaunchDarkly for feature flag management.
- Easy-to-use API for toggling features.
- Real-time updates for feature flags.
Installation #
Add the following to your pubspec.yaml file:
dependencies:
littlefish_config_launchdarkly: ^0.0.1
Then, run flutter pub get to install the package.
Usage #
Import the package in your Dart code:
import 'package:littlefish_config_launchdarkly/littlefish_config_launchdarkly.dart';
Initialize the LaunchDarkly client:
void main() async {
final ldClient = await LaunchDarklyClient.initialize('YOUR_MOBILE_KEY');
runApp(MyApp(ldClient: ldClient));
}
Use the client to check feature flags:
class MyApp extends StatelessWidget {
final LaunchDarklyClient ldClient;
MyApp({required this.ldClient});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Littlefish App')),
body: Center(
child: FutureBuilder<bool>(
future: ldClient.isFeatureEnabled('new_feature'),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasData && snapshot.data == true) {
return Text('New Feature Enabled!');
} else {
return Text('New Feature Disabled.');
}
},
),
),
),
);
}
}
Contributing #
Contributions are welcome! Please open an issue or submit a pull request.
License #
This project is licensed under the MIT License. See the LICENSE file for details.