flutter_exceptions_redux 0.0.3

Flutter Android iOS web

Exception handling state and middleware for redux in Flutter.

example/README.md

To instantiate and add middleware

ExceptionRedux<AppState> exceptionRedux = ExceptionRedux(
    exceptionHandler: (e) => print(e),
    exceptionHistorySize: 10,
store = Store<AppState>(
    middleware: exceptionRedux.createExceptionMiddleware()
      ..addAll(appMiddleware()),
  );

To add to app state:

class AppState {
  ...
  ExceptionState exceptionState;
  ...

  AppState(
    ...
    this.exceptionState,
    ...
  );

  AppState copyWith({
    ...
    ExceptionState exceptionState,
    ...
  }){
    return AppState(
      ...
      exceptionState: exceptionState ?? this.exceptionState,
      ...
    );
  }

  factory AppState.initial(){
    return AppState(
      ...
      exceptionState: ExceptionState.initial(),
      ...
    );
  }
}

To add the reducer:

AppState appReducer(AppState state, action) {
  return AppState(
    ...
    exceptionState: exceptionReducers(state.exceptionState, action),
    ...
  );
}