fluttercommunity / fluttercommunity/redux.dart

Middleware creation failure does not throw error

Open
#58 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
519
Forks
57
PR merge metrics
No merged PRs in 30d

Description

For the following code:
```dart
List> createMiddlewares() {
final onFetchWishListMiddleware = _onFetchWishList();

return [
TypedMiddleware(onFetchWishListMiddleware),
];
}

Middleware _onFetchSomething(SomethingService service) {
return (Store store, action, NextDispatcher next) async* {
next(action);

var user = selectors.getCurrentUser(store.state);

service.list().listen((List items) {
store.dispatch(FetchSomethingSuccessAction(items));
});
};
}
```

I accidentally put in `async*` which shouldn't be there, then this action's middleware and reducer wouldn't run, but it also didn't throw any error. Are we able to provide `Middleware` with a better type so we get warnings on things like this early?

Filed an issue in `flutter_redux` but we thought it's better suited here (https://github.com/brianegan/flutter_redux/issues/178)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.