Storage class abstract final

A typed key-value store with JSON, number and bool helpers.

Storage.instance.writeString('token', value);
final String? token = Storage.instance.readString('token');

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

backend ↔ StorageBackend
The active backend. Swap this to use a real persistence layer.
getter/setter pair

Static Methods

clear() → void
Clears all data.
readBool(String key) → bool?
Reads a bool value.
readBytes(String key) → Uint8List?
Reads a UTF-8 byte list.
readDouble(String key) → double?
Reads a double value.
readInt(String key) → int?
Reads an int value.
readJson(String key) → Object?
Reads a decoded JSON value, or null.
readString(String key) → String?
Reads a string value.
remove(String key) → void
Removes a key.
writeBool(String key, {required bool value}) → void
Writes a bool value.
writeBytes(String key, List<int> bytes) → void
Stores a byte list (base64 encoded).
writeDouble(String key, double value) → void
Writes a double value.
writeInt(String key, int value) → void
Writes an int value.
writeJson(String key, Object? value) → void
Encodes and stores value as JSON.
writeString(String key, String value) → void
Writes a string value.