DevToolsState<S>.fromApp constructor

DevToolsState<S>.fromApp(
  1. DevToolsState<S> state,
  2. DevToolsAction devToolsAction,
  3. List<S> computedStates,
  4. List stagedActions,
  5. Reducer<S> appReducer,
)

Create a new instance of the DevToolsState using a normal application Action and Reducer.

Implementation

factory DevToolsState.fromApp(
  DevToolsState<S> state,
  DevToolsAction devToolsAction,
  List<S> computedStates,
  List<dynamic> stagedActions,
  Reducer<S> appReducer,
) {
  final newStates = <S>[...computedStates];
  final newActions = <dynamic>[...stagedActions];

  newStates.add(
    appReducer(
      state.currentAppState,
      devToolsAction.appAction,
    ),
  );

  newActions.add(devToolsAction.appAction);

  return DevToolsState<S>(newStates, newActions, newStates.length - 1);
}