DatasourceLocal<ValueType, D extends Driver> class
abstract
An abstract DataSource designed to manage a single, uniquely identifiable piece of data stored locally (e.g., configurations, tokens, preferences).
This class represents a local source of truth for a specific data item. It enforces the use of a unique key and delegates read, write, and delete operations to the injected driver.
ValueType: The type of data being managed and stored.D: The specific type of Driver implementation used for storage (e.g., BasicDriver).
- Inheritance
-
- Object
- DataSource
- DatasourceLocal
Constructors
- DatasourceLocal(D driver)
- An abstract DataSource designed to manage a single, uniquely identifiable piece of data stored locally (e.g., configurations, tokens, preferences).
Properties
- driver → D
-
The underlying Driver responsible for handling the low-level storage
operations (e.g., reading/writing to Shared Preferences or Hive).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → String
-
The unique key used to identify and retrieve the
ValueTypein the underlying storage.no setter - observer → SimpleObserver
-
Retrieves the standard observer instance used to track the lifecycle
and events of all Data Sources in the application.
no setterinherited
-
read
→ Future<
ValueType?> -
Retrieves the stored value from the local storage.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
call(
) → Future< ValueType?> - Retrieves the stored value from the local storage.
-
delete(
) → Future< void> - Removes the stored value associated with the key from the local storage.
-
dispose(
) → void -
Called when the DataSource instance is no longer needed and should
release any held resources (e.g., closing connections, unregistering listeners).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
ValueType? value) → Future< void> -
Stores the given
valueinto the local storage using the defined key. -
save(
ValueType value) → Future< void> - Internal method responsible for the concrete storage operation.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited