SecureHydratedStorage class
A HydratedStorage backend implementation that persists state using
secure key-value storage (such as FlutterSecureStorage).
Pre-loads all stored key-value pairs into an in-memory cache during build so that subsequent read requests are returned synchronously on frame 1 without UI flickers.
Example:
import 'package:bloc_signals_hydrate/bloc_signals_hydrate.dart';
import 'package:bloc_signals_hydrate/secure_storage.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final secureStorage = const FlutterSecureStorage();
HydratedStorage.storage = await SecureHydratedStorage.build(secureStorage);
runApp(const MyApp());
}
- Implemented types
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → FutureOr< void> -
Clears all keys and values from storage.
override
-
delete(
String key) → FutureOr< void> -
Deletes value associated with
keyfrom storage.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String key) → dynamic -
Reads value associated with
keyfrom storage.override -
toString(
) → String -
A string representation of this object.
inherited
-
write(
String key, dynamic value) → FutureOr< void> -
Writes
valueassociated withkeyto storage.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
build(
dynamic secureStorage) → Future< SecureHydratedStorage> -
Asynchronously pre-loads stored keys from
secureStorageinto memory, returning a fully initialized SecureHydratedStorage ready for synchronous frame 1 state hydration.