call method
Implementation
@override
Stream<TState> call(
Context<TState> context,
Event event,
NextMiddleware<TState> next,
) async* {
if (event is InitApplicationEvent) {
final loadedState = await storage.load();
if (loadedState != null) {
yield loadedState;
}
}
if (event is ClearPersistence) {
await storage.clear();
} else {
await for (final state in next(context, event)) {
yield state;
_debouncing.throttle(() async {
await storage.save(context.state);
});
}
}
}