persistDifference method

  1. @override
Future<void> persistDifference({
  1. T? lastPersistedState,
  2. T? newState,
})
override

Save the new state to the persistence. lastPersistedState is the last state that was persisted since the app started, while newState is the new state to be persisted.

Note you have to make sure that newState is persisted after this method is called. For simpler apps where your state is small, you can just ignore lastPersistedState and persist the whole newState every time. But for larger apps, you should compare lastPersistedState and newState, to persist only the difference between them.

Implementation

@override
Future<void> persistDifference({lastPersistedState, newState}) async => null;