get method
Retrieves the value associated with the key
.
Throws an exception if the key is not found.
Implementation
@override
Future<Uint8List> get(String key) async {
await _ensureDbOpen();
final transaction = _db!.transaction('data', 'readonly');
final store = transaction.objectStore('data');
final data = await store.getObject(key);
await transaction.completed;
if (data is Uint8List) {
return data;
} else if (data == null) {
throw Exception('Key not found in cache: $key');
} else {
throw Exception('Data is not of type Uint8List');
}
}