feature_core 1.1.1 feature_core: ^1.1.1 copied to clipboard
Core classes and contracts for managing features.
feature_core #
Manages feature flags in your application. This is the core library.
Additional packages #
There are several additional libraries created to make this one work. I hope this list will be expanded in the future.
- feature_flutter - integration and management of features in the flutter application.
Wrappers #
- feature_wrapper_retain - adds ability to locally save state of features
Feature sources #
- feature_source_firebase - implementation for remote firebase config
Concept #
There are three main entities:
-
FeatureAbstract
represents some kind of customization for the application. -
FeaturesProvider
implements a function that retrieves functions from some repository. -
FeaturesManager
manages your providers and handles their requests to pull.
Usage #
Creating a feature #
To create a feature, just inherit from the FeatureGeneric<T>
class.
class UseNewComponent extends FeatureGeneric<bool> {
const UseNewComponent(bool value) : super(key: 'some_new_component', value: value);
}
Creating a feature provider #
To add your own feature source, inherit from FeatureProvider
and implement the pullFeatures()
method.
The rest is up to you.
Important note: if you need to update the features from within FeatureProvider
(for example, if you get updates from the backend), use requestPullFeatures()
to reacquire the features.
Creating the manager #
First, create a FeaturesManager and populate it with your sources.
Use with Flutter #
See the feature_flutter package to integrate features into the Flutter application.