feature_flutter 1.2.0 copy "feature_flutter: ^1.2.0" to clipboard
feature_flutter: ^1.2.0 copied to clipboard

Flutter package for convenient use of feature flags. Designed for use with feature_core package.

feature_flutter #

Important note: We recommend that you read about the feature_core package before using it.

Usage #

With the feature_flutter package you can integrate features into the Flutter application.

The package provides three main widgets: FeaturesProvider, FeatureWidget, DebugFeaturesWidget.

FeaturesProvider

Passes the manager down the tree.

void main() {
  final FeaturesManager featuresManager = FeaturesManager(...);

  runApp(MaterialApp(
    home: FeaturesProvider(
      manager: featuresManager,
    ),
    ...
  ));
}

FeatureWidget

Allows you to show/hide widgets depending on the value of a feature.

You can use a simplified variant

FeatureWidget(
  feature: featuresManager.getFeature('feature_key'),
  child: Text(
    'child when feature: has 'false' value,'
    'OR is disabled OR not found in manager',
  ),
  activatedChild: Text(
    'child when feature found in manager AND is enabled.'
  ),
  visible: true, // default, totally shows/hides widget
)

Or you can handle feature values more flexibly through the builder.

Important note: By default, if the bilder returns nothing, an empty SizedBox is used.

FeatureWidget.builder(
  feature: featuresManager.getFeatureByType<SomeFeature>(),
  builder: (BuildContext context, Feature? feature) {
    if (feature == null) {
      return // your widget here
    }
    if (feature.enabled) {
      return // your widget here
    }
  },
)

DebugFeaturesWidget

Just a handy widget which depends on the manager and gives access to enable/disable features.

1
likes
130
pub points
0%
popularity

Publisher

verified publisherdart.nogipx.dev

Flutter package for convenient use of feature flags. Designed for use with feature_core package.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

feature_core, flutter, rxdart

More

Packages that depend on feature_flutter