bloc
bloc copied to clipboard
feat: Make hydrated_storage.dart:Storage.read() method async
Description
I want to provide my own sqlite backed implementation of Storage but i need the read method to be async like the rest of the methods in Storage class, most sqlite libs execute queries async.
Desired Solution
Make the read method Future
/// Interface which is used to persist and retrieve state changes.
abstract class Storage {
/// Returns value for key async
Future<dynamic> read(String key);
Alternatives Considered
A workaround of loading an entire table in memory to be accessible to synchronous read method is sub-optimal to say at least.
Additional Context
The errror above appears randomly on some devices. In the past i have used hive for other purposes and had to eliminate it due to this, hive works but its not reliable, it has issues especially when android apps are paused/resumed.