State class

A state stored in DataStorage.

Constructors

State(DataStorage storage, String name)

Properties

hashCode → int
The hash code for this object.
no setterinherited
isLoaded → bool
Returns true if this state is already loaded. See onLoad and waitLoaded.
no setter
keys → List<String>
Returns the storage keys in this state.
no setter
name → String
Name of this state.
final
onLoad → EventStream<bool>
Fired when this State is loaded. See waitLoaded and isLoaded.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
storage → DataStorage
The storage of this state.
final
storageRootKey → String
no setter

Methods

fireLoadedKeysEvents() → State
get<V>(String key) → V?
Gets key value.
getAsync<V>(String key) → Future<V?>
Gets the value of key in async mode.
getKeysAsync() → Future<List<String>>
Same as keys, but async.
getOrDefault<V>(String key, V? defaultValue) → V?
Gets key value or returns defaultValue.
getOrDefaultAsync<V>(String key, dynamic defaultValue) → Future<V?>
Gets key value. If absent returns defaultValue.
getOrSetDefault<V>(String key, V? defaultValue) → V?
Gets key value. If absent sets the key value to defaultValue and returns it.
getOrSetDefaultAsync<V>(String key, dynamic defaultValue) → Future<V?>
Gets key value. If absent sets the key to defaultValue and returns it.
getStorageKey(String key) → String
Returns the internal storage key for key.
listen(StateOperation op, StateEventListener listener) → State
Listen for op events.
listenAll(StateEventListener listener) → State
Listen all events.
listenKey(String key, StateKeyListener listener) → State
Listen for a specific key events.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String key) → dynamic
Remove key.
set<V>(String key, V? value) → V?
Sets key to value.
setIfAbsent<V>(String key, V? value) → bool
Sets key to value if not stored yet.
toString() → String
A string representation of this object.
inherited
waitLoaded() → FutureOr<bool>
Waits for this State load. See onLoad and isLoaded.

Operators

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