fluttercommunity / redux.dart

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

Have dispatch return a value #52

Closed andrasferenczi closed 4 years ago

andrasferenczi commented 4 years ago

This is related to #26.

A return value has been added to the dispatch and all related middleware functions. These are necessary to be able to be able to await the result of an async process (as asked in this issue on how to redux_thunk).

dynamic return value has the following advantages:

Dart's type system is not complex enough (as opposed to TypeScript's) to be able to write union types when you want to chain together a middleware that may return an object of type A and another that may return an object of type B. So I don't see any other meaningful way to implement return values other than dynamic.

@johnpryan Hope this can be merged soon. Thanks.

brianegan commented 4 years ago

Hey, thanks so much! We're working on version 4.x and would love to include this change. Great work!

codecov-io commented 4 years ago

Codecov Report

Merging #52 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #52   +/-   ##
======================================
  Coverage    92.1%   92.1%           
======================================
  Files           2       2           
  Lines          38      38           
======================================
  Hits           35      35           
  Misses          3       3
Impacted Files Coverage Δ
lib/src/utils.dart 100% <100%> (ø) :arrow_up:
lib/src/store.dart 88% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a2bbdac...01f5ad5. Read the comment docs.