ModelStore class abstract
Stores and manages models of the app.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
add<
T extends SignalModel> (ModelBuilder< T> modelBuilder, [String? id]) → void -
Adds a model to the Store.
No model is added if a model of same type already exists.
Model is added lazily that is no model is created until it is
accessed for the first time.
To add a model when another one of same type already exists, provide
a unique string id using the optional
idparameter. -
addEager<
T extends SignalModel> (T model, [String? id]) → void -
Adds the model to the store immediately instead of lazily like ModelStore.add
Provide a unique string id to the optional
idparameter to add more than one instance of same model. -
clear(
) → void - Removes all the models from the store.
-
get<
T extends SignalModel> ([String? id]) → T? -
Returns the model of given type from the store.
Returns null if no such model exists.
Use the
idparameter to get an instance of id model. See ModelStore.add for details. -
remove<
T extends SignalModel> ([String? id]) → T? -
Removes the model of given type from the store and returns it.
It also calls the dispose method of the model.
Returns null if no model is found.
Use the
idparameter to remove an instance of id model. See ModelStore.add for details. -
replace<
T extends SignalModel> (ModelBuilder< T> builder, [String? id]) → void - Replaces an existing model from the store with the same type of the given model.