fluttercommunity / redux.dart

Redux for Dart
https://pub.dev/packages/redux
MIT License
515 stars 61 forks source link

Change the return type of `Store.dispatch` to `void` #85

Closed Maksimka101 closed 11 months ago

Maksimka101 commented 11 months ago

I've noticed that Store.dispatch method doesn't return anything. Never. So it would be a good idea to specify it

NextDispatcher typedef also should return void, not a dynamic

I can create a pull request with this change, if you agree with me

brianegan commented 11 months ago

This is not true. Please reread the function: It returns the value from the chain of middleware (specified by the consumer of this library), and this is the intention from the original JS library on which this is inspired.

Changing the signature to void would break many middleware in the wild, such as the thunk middleware. There are even tests for this functionality here:

https://github.com/fluttercommunity/redux.dart/blob/master/test/middleware_test.dart#L94