MpStateManager class
Typed facade around MpStore owned by a mini-program host instance.
Constructors
- MpStateManager({MpStore? store, MiniProgramLiveStatePolicy policy = const MiniProgramLiveStatePolicy()})
-
Creates a state manager backed by
storeor a new MpStore.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- policy → MiniProgramLiveStatePolicy
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- store → MpStore
-
Backing store for advanced host-side inspection and tests.
final
Methods
-
batchUpdates(
void updates()) → void - Applies synchronous state writes atomically with one watcher update.
-
clear(
) → void - Clears all memory state for this mini-program instance.
-
contains(
String key) → bool -
Whether
keycurrently exists, including null values. -
dispose(
) → void - Releases state resources.
-
get<
T> (String key) → T? -
Reads
keyand casts it toTwhen possible. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, Object? value) → void -
Creates or replaces
keywithvalue. -
remove(
String key) → void -
Removes
keyif present. -
set(
String key, Object? value) → void -
Replaces
keywithvalue. -
toBindingData(
) → Map< String, dynamic> -
Binding data exposed under
{{state.*}}. -
toString(
) → String -
A string representation of this object.
inherited
-
updatePolicy(
MiniProgramLiveStatePolicy policy) → void -
watch(
String key) → ValueListenable< Object?> -
Watches
keyfor related changes.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited