fluttercommunity / redux.dart

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

const reducers #73

Open 2ZeroSix opened 3 years ago

2ZeroSix commented 3 years ago

Allow to build entire reducers tree as const object.

codecov-io commented 3 years ago

Codecov Report

Merging #73 (4da85ce) into master (8872c0b) will decrease coverage by 3.21%. The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
- Coverage   92.10%   88.88%   -3.22%     
==========================================
  Files           2        2              
  Lines          38       45       +7     
==========================================
+ Hits           35       40       +5     
- Misses          3        5       +2     
Impacted Files Coverage Δ
lib/src/utils.dart 90.00% <75.00%> (-10.00%) :arrow_down:

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 8872c0b...4da85ce. Read the comment docs.

hacker1024 commented 3 years ago

I think similar changes can also be made to middleware.

hacker1024 commented 3 years ago

This PR has been open for a while, does anyone have anything to say?

brianegan commented 3 years ago

Thanks! Sorry -- only have a little bit of time for open source these days and missed this one. Could you please describe in a bit more detail the problem you want to solve with this PR? Sure, const is nice, but this PR seems to introduce some complexity in order to support const Reducers. For example, combineReducers and CombineReducers looks kinda rough.

Do const reducers bring enough of an advantage to outweigh the larger API surface?

In my view, Reducer classes are instantiated once, when the app is first created. They aren't like Widgets which can re-instantiated over and over, where a const constructor really shines. What do you think?