read<T> method
Returns the value for the given key
or null if key
is not in the storage.
Supports String and Uint8List values.
Implementation
Future<T?> read<T>({required String key}) async {
assert(key.isNotEmpty, 'key must not be empty');
return _synchronized(key, () async {
final result = await performRead(key: key);
if (result == null) return null;
if (T == String) return utf8.decode(result) as T;
return result as T;
});
}