flutter_exceptions_redux 0.0.1 flutter_exceptions_redux: ^0.0.1 copied to clipboard
Exception handling state and middleware for redux in Flutter.
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),
...
);
}