LocalDatabase class abstract
Allows access to local storage on the device. Implementations of this class should be able to store and retrieve data from the device's local storage. This is mainly used to store data via actions for the SDK.
This abstraction provides access to the local storage via a key-value store. The key is a string and the value is an object. The object can be any primitive type or a list or map of primitive types depending on the implementation.
- Inheritance
-
- Object
- ChangeNotifier
- LocalDatabase
- Implementers
Constructors
- LocalDatabase({required String identifier})
- Creates a LocalDatabase with the given identifier.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- identifier → String
-
The identifier for the storage. This is used to identify the storage
from its project id.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clear(
) → Future< void> - Clears all the data in the storage.
-
containsKey(
String key) → bool -
Whether or not the storage contains the given
key
. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
get(
String key, {Object? defaultValue}) → Object? -
Returns the value stored in the storage with the given
key
. If the key is not found or has a null value, then thedefaultValue
is returned. -
getAll(
) → Map< String, dynamic> - Returns all the data in the storage as a map.
-
getNotifier(
String? key) → Listenable -
Returns a
_StorageListenable
that notifies when the value for the givenkey
in the storage changes. These listeners are automatically disposed when the storage is closed usingclose
method. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
put(
String key, Object? value) → Future< void> -
Stores the given
value
in the storage with the givenkey
. -
remove(
String key) → Future< void> -
Removes the value stored in the storage with the given
key
. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reset(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited