observe abstract method

void observe(
  1. ReduxAction<St> action,
  2. St prevState,
  3. St newState,
  4. Object? error,
  5. int dispatchCount,
)
  • action = The action itself.

  • prevState = The state right before the new state returned by the reducer is applied. Note this may be different from the state when the reducer was called.

  • newState = The state returned by the reducer. Note: If you need to know if the state was changed or not by the reducer, you can compare both states: bool ifStateChanged = !identical(prevState, newState);

  • error = Is null if the reducer completed with no error and returned. Otherwise, will be the error thrown by the reducer (before any wrapError is applied). Note that, in case of error, both prevState and newState will be the current store state when the error was thrown.

  • dispatchCount = The sequential number of the dispatch.

Implementation

void observe(
  ReduxAction<St> action,
  St prevState,
  St newState,
  Object? error,
  int dispatchCount,
);