Created
April 16, 2018 16:17
-
-
Save xrigau/a665affbd76a329c80d167be675b8ab2 to your computer and use it in GitHub Desktop.
Introduction to Redux in Flutter (reducer.dart)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AppState appReducer(AppState state, action) => AppState(toDoListReducer(state.toDos, action), listStateReducer(state.listState, action)); | |
final Reducer<List<ToDoItem>> toDoListReducer = // Boilerplate ignored | |
final Reducer<ListState> listStateReducer = combineReducers<ListState>([ | |
TypedReducer<ListState, DisplayListOnlyAction>(_displayListOnly), | |
TypedReducer<ListState, DisplayListWithNewItemAction>(_displayListWithNewItem), | |
]); | |
ListState _displayListOnly(ListState listState, DisplayListOnlyAction action) => ListState.listOnly; | |
ListState _displayListWithNewItem(ListState listState, DisplayListWithNewItemAction action) => ListState.listWithNewItem; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment