Store class abstract
Stores and manages models of the app.
Constructors
- Store()
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 Model> (ModelBuilder< T> modelBuilder, {String? id, bool lazy = true}) → void -
Adds a model to the Store.
No model is added if a model of same type already exists.
Model is added lazily unless
lazyis false 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 optionalidparameter. -
clear(
) → void - Removes all the models from the store.
-
get<
T extends Model> ([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 Store.add for details. -
remove<
T extends Model> ([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 Store.add for details. -
replace<
T extends Model> (ModelBuilder< T> builder, [String? id]) → void - Replaces an existing model from the store with the same type of the given model.