ReactrStorage class

A synchronous wrapper around SharedPreferences for Reactr state management.

ReactrStorage provides synchronous getter and setter methods for persistent storage. It must be initialized before use, typically in the ReactrMaterialApp.

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 Properties

isInitialized → bool
Checks if ReactrStorage has been initialized.
no setter

Static Methods

clear() → void
Clears all data from storage synchronously. Note: The actual clearing from disk happens asynchronously in the background.
clearAsync() → Future<bool>
Clears all data and returns a Future that completes when the clearing is done.
containsKey(String key) → bool
Checks if a key exists in storage.
getBool(String key) → bool?
Gets a boolean value from storage.
getDouble(String key) → double?
Gets a double value from storage.
getInt(String key) → int?
Gets an integer value from storage.
getKeys() → Set<String>
Gets all keys from storage.
getString(String key) → String?
Gets a string value from storage.
getStringList(String key) → List<String>?
Gets a string list from storage.
init() → Future<void>
Initializes the ReactrStorage with SharedPreferences instance. This should be called once at app startup, preferably in ReactrMaterialApp.
reload() → Future<void>
Reloads the storage data from the platform.
remove(String key) → void
Removes a value from storage synchronously. Note: The actual removal from disk happens asynchronously in the background.
removeAsync(String key) → Future<bool>
Removes a key and returns a Future that completes when the removal is done.
setBool(String key, bool value) → void
Sets a boolean value in storage synchronously. Note: The actual write to disk happens asynchronously in the background.
setBoolAsync(String key, bool value) → Future<bool>
Sets a boolean value and returns a Future that completes when the write is done.
setDouble(String key, double value) → void
Sets a double value in storage synchronously. Note: The actual write to disk happens asynchronously in the background.
setDoubleAsync(String key, double value) → Future<bool>
Sets a double value and returns a Future that completes when the write is done.
setInt(String key, int value) → void
Sets an integer value in storage synchronously. Note: The actual write to disk happens asynchronously in the background.
setIntAsync(String key, int value) → Future<bool>
Sets an integer value and returns a Future that completes when the write is done.
setString(String key, String value) → void
Sets a string value in storage synchronously. Note: The actual write to disk happens asynchronously in the background.
setStringAsync(String key, String value) → Future<bool>
Sets a string value and returns a Future that completes when the write is done.
setStringList(String key, List<String> value) → void
Sets a string list in storage synchronously. Note: The actual write to disk happens asynchronously in the background.
setStringListAsync(String key, List<String> value) → Future<bool>
Sets a string list and returns a Future that completes when the write is done.