MpStore class
In-memory state store for one active mini-program host instance.
Values are intentionally memory-only. Persistent data belongs in a future storage layer, while private data should remain behind publisher APIs.
Constructors
- MpStore({MiniProgramLiveStatePolicy policy = const MiniProgramLiveStatePolicy()})
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
Methods
-
batchUpdates(
void updates()) → void - Applies synchronous updates atomically and coalesces watcher changes.
-
clear(
) → void - Clears all state values for the current mini-program instance.
-
contains(
String key) → bool -
Whether
keycurrently exists, including values explicitly set to null. -
dispose(
) → void - Releases watcher 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> - Returns a defensive copy of the state namespace for binding resolution.
-
toString(
) → String -
A string representation of this object.
inherited
-
updatePolicy(
MiniProgramLiveStatePolicy policy) → void -
watch(
String key) → ValueListenable< Object?> -
Watches
key. The returned listenable only updates for related paths.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited