DefaultFeatureMapper class

If the default FeatureState enum is enough for your current app, then this default mapper can be imported and used with the instance of the FeatureStateProvider.

Inheritance

Constructors

DefaultFeatureMapper.new()

Properties

debugState Map<Feature, FeatureState>
A development-only way to access state outside of StateNotifier.
no setterinherited
defaultState FeatureState
This override is used to determine the default value among the possible states according to the choosen data type. This value will be used when the parsing process finds string states that don't match to any possible states, and also while trying to retrieve the state of features that don't exist in the map or whose name don't match
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
If a listener has been added using addListener and hasn't been removed yet.
no setterinherited
mounted bool
Whether dispose was called or not.
no setterinherited
onError ↔ ErrorListener?
A callback for error reporting if one of the listeners added with addListener throws.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state Map<Feature, FeatureState>
The current "state" of this StateNotifier.
getter/setter pairinherited
stream Stream<Map<Feature, FeatureState>>
A broadcast stream representation of a StateNotifier.
no setterinherited

Methods

addListener(Listener<Map<Feature, FeatureState>> listener, {bool fireImmediately = true}) → RemoveListener
Subscribes to this object.
inherited
append(Map<String, dynamic> json) → void
If the initial mapping already exists, this method combines a new JSON map with the existing one. This is a normal map join, so adding entries with the same name as existing ones will replace the value
inherited
dispose() → void
Frees all the resources associated to this object.
inherited
getStateFor(Feature feature) FeatureState
This is the method called by other classes in the app, specially the FeatureWidget, to obtain the current state of any feature in the map
inherited
load(Map<String, dynamic> json) → void
This method creates the interl mapping of states, and the JSON that serves as the input should have the following structure: { "features": {"name": "example", "state": "STATE_VALUE"} }
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseState(String state) FeatureState
This override is required to map correctly between the string values in the JSON and the state values of the choosen data type
override
toString() String
A string representation of this object.
inherited
updateShouldNotify(Map<Feature, FeatureState> old, Map<Feature, FeatureState> current) bool
Whether to notify listeners or not when state changes
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited