Loading...
Searching...
No Matches
StorageManager Class Referenceabstract

Interface for managing multiple key-value storages, providing access and lifecycle control. More...

Inherits Finalizable.

Public Member Functions

List< String > getStorageList ()
 
KeyValueStorage getStorage (String name)
 
void removeStorage (String name)
 

Detailed Description

Interface for managing multiple key-value storages, providing access and lifecycle control.

Referenced from NavigineSdk.

Definition at line 19 of file storage_manager.dart.

Member Function Documentation

◆ getStorage()

KeyValueStorage StorageManager.getStorage ( String name)

Returns a handle to a storage by name, creating it if it does not exist.

Parameters
nameStorage name (case-sensitive).
Returns
Key–value storage instance KeyValueStorage

Dart code snippet:

// Get or create different storage instances
_userStorage = _storageManager!.getStorage("user_preferences");
_appStorage = _storageManager!.getStorage("app_settings");
_cacheStorage = _storageManager!.getStorage("cache");

◆ getStorageList()

List< String > StorageManager.getStorageList ( )

Returns the list of all existing user storages.

Returns
List of storage names (implementation currently returns them in alphabetical order).

Dart code snippet:

// Get list of all existing storages
List<String> storageList = _storageManager!.getStorageList();
print("Existing storages: $storageList");

◆ removeStorage()

void StorageManager.removeStorage ( String name)

Removes the storage and all its persisted data. If the storage does not exist, this is a no-op.

Parameters
nameStorage name (case-sensitive).
Note
Existing handles to this storage become invalid after removal and further operations may fail.

Dart code snippet:

// Remove storage and all its data
_storageManager!.removeStorage("test_storage");
print("Removed test storage");

The documentation for this class was generated from the following file: