StorageDataSource class abstract base

Implementation of the PersistenceInterface for FlutterSecureStorage. Use this to store private data, of which there is a small amount. Be sure to call initAsync after the constructor and wait for it to execute. Calling dispose is desirable, but not necessary.

Inheritance

Constructors

StorageDataSource(HiveInterface _hive, {required String databaseName, int databaseVersion = 1})

Properties

databaseExpiredDuration Duration?
Common default field for putExpired, putExpiredTyped. Sets the expiration date for the database, will be automatically substituted into the query if a named argument is not specified. To use it, you need to override.
no setterinherited
databaseName String
Name of the database
final
databaseVersion int
The current version of the database. When changing the data structure, iterate the current version and confirm the corresponding changes in migrate
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

containsKey(String key) Future<bool>
Returns true if there is an entry for such a key
override
delete(String key) Future<void>
Delete a record from the database
override
dispose() Future<void>
The function should release the elements when the class is closed
inherited
get(String key) Future<String?>
Read a record from the database
override
getBool(String key) Future<bool?>
Gets true if the key has the value "true", otherwise false.
inherited
getExpired(String key, {bool needRefresh = kNeedRefreshDefault}) Future<String?>
Getting the "expired" value. If you specify the needRefresh - start of the expiration counter, the value will change to the current date and time.
inherited
getExpiredTyped<T extends Object>(String key, T fromJson(Map<String, Object?> json), {bool needRefresh = kNeedRefreshDefault}) Future<T?>
The same as getExpired, but using structures and deserialization
inherited
getInt(String key) Future<int?>
Gets the corresponding numeric value by key
inherited
getJsonListTyped<T extends Object>(String key, T fromJson(Map<String, Object?> json)) Future<List<T>?>
inherited
getJsonTyped<T extends Object>(String key, T fromJson(Map<String, Object?> json), {T? defaultValue}) Future<T?>
Will return the structure by key, steam it through the fromJson method. If you need a default value, pass it as an argument defaultValue, however we cannot guarantee it, so use "!".
inherited
initAsync({HiveCipher? encryptionCipher, String? path, String? collection}) Future<void>
The function that is called after opening the box. Must definitely wait
override
initExpiredSystem() Future<void>
Must be called in initAsync Loads settings (including keys), checks the relevance of all values using __checkExpired
inherited
initMigrations() Future<void>
You need to call this function and wait after the constructor. It causes migrations. If you need an action in the database when opening, write it in migrate
inherited
migrate(int oldVersion, int currentVersion) Future<void>
It will be called automatically once, during the initAsync call. Updates data structures between versions
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put({required String key, required String? value}) Future<void>
Write a record from the database
override
putBool(String key, {required bool value}) Future<void>
Puts a boolean variable in nosql, doing the conversion
inherited
putExpired({required String key, required String value, Duration? expirationDuration}) Future<void>
inherited
putExpiredTyped(String key, Map<String, Object?> valueJson, {Duration? expirationDuration}) Future<void>
The same as putExpired, but using structures and serialization
inherited
putInt(String key, {required int value}) Future<void>
Puts the corresponding numeric value on the key
inherited
putJsonListTyped(String key, List<Map<String, Object?>> json) Future<void>
inherited
putJsonTyped(String key, Map<String, Object?> json) Future<void>
Saves the structure by key. Important for use, pass it sterilized to Map<String, Object?>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited