fluttercommunity / redux.dart

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

IntellJ complains about typings when combining reducers #39

Closed DanielSoCra closed 6 years ago

DanielSoCra commented 6 years ago

First of all, thank you for this libary !

So when I combine reducers in IntelliJ (AndroidStudio), this happnens:

This works fine:

final Reducer eventFilterReducer = combineReducers([
  addFilterReducer,

]);

List<ZEventFilter> addFilterReducer (eventFilters, action){
  return List.from(eventFilters)..add(action.eventFilter);
}

This lints a typecast error.

final Reducer eventFilterReducer = combineReducers([
  addFilterReducer <--"The element type '(List<ZEventFilter>, dynamic= -> List<ZEventFilter>' can't be assigned to the list type '(dynamic, dynamic) -> dynamic'" ,

]);

List<ZEventFilter> addFilterReducer (List<ZEventFilter> eventFilters, AddEventFilterAction action){
  return List.from(eventFilters)..add(action.eventFilter);
}

Must be the linter, not the libary right?

Best regards, Daniel

DanielSoCra commented 6 years ago

Mybad, shouldn't code that late ^^

actually I have to use TypedReducer for this one

johnpryan commented 6 years ago

Glad it's working for you :)