LevitStore<T> class

A portable container definition for managing reusable state.

LevitStore works like a "recipe" for creating state. Unlike LevitController, which you register manually, LevitStore is passed around by reference and instantiated on demand.

When you call find, it lazy-loads the instance in the current scope.

Constructors

LevitStore(T _builder(LevitRef ref))
Creates a scoped store definition from builder.

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

delete({String? tag, bool force = false}) Future<bool>
Removes this store from the active scope.
deleteIn(LevitScope scope, {String? tag, bool force = false}) Future<bool>
Deletes the store instance from scope.
find({String? tag}) → T
Finds the value of this store in the active scope.
findAsync({String? tag}) Future<T>
Asynchronously finds the value of this store in the active scope.
findAsyncIn(LevitScope scope, {String? tag}) Future<T>
Asynchronously finds or creates the store instance within scope.
findIn(LevitScope scope, {String? tag}) → T
Finds or creates the store instance within scope.
isInstantiatedIn(LevitScope scope, {String? tag}) bool
Checks whether this store is instantiated in scope.
isRegisteredIn(LevitScope scope, {String? tag}) bool
Checks whether this store is registered in scope.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

async<T>(Future<T> builder(LevitRef ref)) LevitAsyncStore<T>
Creates an asynchronous store definition from builder.