put method
Save to local storage
Implementation
@override
/// Save to local storage
Future<void> put(String key, value) async {
try {
final db = await _initDB();
final transaction = db.transaction(storeName, 'readwrite');
final store = transaction.objectStore(storeName);
if (mode == EncryptionMode.fernet && encryptionKey != null) {
await store.put(fernet.encryptFernet(value, encryptionKey!), key);
} else if (mode == EncryptionMode.aes && encryptionKey != null) {
await store.put(aes.encryptAES(value, encryptionKey!), key);
} else {
await store.put(value, key);
}
await transaction.completed;
db.close();
} catch (e) {
debugPrint(e.toString());
//rethrow;
}
}