onStateChanged method

  1. @override
void onStateChanged(
  1. State oldState,
  2. State currentState
)
override

this method is called when the state has been changed

Implementation

@override
void onStateChanged(State oldState, State currentState) {
  final json = toJson(currentState);
  if (json != null) {
    storage
        .save(
          storageKey,
          json,
        )
        .onError(
          onPersistentStateError,
        );
  }
}