AppStorage class
A singleton class that provides a wrapper around the GetStorage API for simple key-value storage operations.
Use AppStorage.instance to access the singleton instance. Call init before using any other methods to initialize the storage.
Example usage:
await AppStorage.instance.init();
AppStorage.instance.setValueFor('key', 'value');
var value = AppStorage.instance.valueFor('key');
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
-
clear(
) → void - Clears all key-value pairs from the storage.
-
init(
{String containerName = 'GetStorage'}) → void -
Initializes the storage with an optional
containerName. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeKey(
String key) → void -
Removes the value associated with the given
keyfrom storage. -
setValueFor(
String key, dynamic value) → void -
Writes a
valueto storage for the givenkey. -
toString(
) → String -
A string representation of this object.
inherited
-
valueFor(
String key) → dynamic -
Reads and returns the value associated with the given
key.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → AppStorage
-
final