AppStorage<T extends StorableModel> class
A singleton class that manages the application's storage operations.
This class provides a centralized way to handle storage-related tasks
by utilizing the StorageEngineBloc for reactive state management and
the LocalStorageEngine for interacting with local storage mechanisms.
Design:
- Implements the singleton pattern to ensure a single instance of
AppStoragethroughout the app's lifecycle. - Provides a
dispose()method to properly release resources and prevent memory leaks.
Usage:
final appStorage = AppStorage();
appStorage.storageBloc.add(SomeStorageEvent());
Responsibilities:
- Manages the
StorageEngineBlocinstance for handling storage events. - Provides access to the
LocalStorageEnginefor local data management. - Ensures proper cleanup of resources when the
dispose()method is called.
Example:
final appStorage = AppStorage();
appStorage.dispose(); // Clean up resources when no longer needed.
Constructors
- AppStorage()
-
Factory constructor to return the same instance of AppStorage.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
storageBloc
→ StorageEngineBloc<
T> -
Manages storage-related state using the BLoC pattern.
final
- storageEngine → LocalStorageEngine
-
Handles low-level local storage operations.
final
Methods
-
dispose(
) → Future< void> - Call this method when AppStorage is no longer needed to ensure proper cleanup and avoid memory leaks.
-
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