feature_flags

Last updated:

0 purchases

feature_flags Image
feature_flags Images
Add to Cart

Description:

feature flags

feature_flags #
This package simply allows you to activate dynamically functionnalities of your app.
Usage #
Setup #
Wrap your app's widget in a Features widget.
Features(
child: MaterialApp(
/// ...
),
);
copied to clipboard
Testing if a feature is enabled #
To test is a feature is currently enabled, use the Features.isFeatureEnabled function with a unique functionnality identifier.
if (Features.isFeatureEnabled(context, 'DECREMENT')) {
/// The 'DECREMENT' feature is enabled
}
copied to clipboard
Enable or disable a feature #
From the Features widget #
By updating the flags from the Features widget.
Features(
flags: [ 'DECREMENT' ],
child: MaterialApp(
/// ...
),
);
copied to clipboard
Enabling it locally from code #
You can activate a feature by calling the Features.setFeature function. The feature flag is saved into shared preferences and is persisted between sessions.
Features.setFeature(
context,
'DECREMENT',
true,
);
copied to clipboard
Using the debug view #
The debug view allow your users to activate or deactivate any dynamic feature.

This may be useful during developpment, but it should be used carefuly.

DebugFeatures.show(
context,
availableFeatures: [
Feature('DECREMENT', name: 'Decrement'),
Feature('RESET', name: 'Reset'),
],
);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.