state property
The current state.
Implementation
@override
State get state {
if (HydratedBlocConfig.offMode) {
return super.state;
}
final storage = HydratedBloc.storage;
if (_state != null) return _state!;
try {
final stateJson = storage.read(storageToken) as Map<dynamic, dynamic>?;
if (stateJson == null) {
_state = super.state;
return super.state;
}
final cachedState = _fromJson(stateJson);
if (cachedState == null) {
_state = super.state;
return super.state;
}
_state = cachedState;
return cachedState;
} catch (error, stackTrace) {
onError(error, stackTrace);
_state = super.state;
return super.state;
}
}