emptyEnvironment<S, A> static method

Store<S, A> emptyEnvironment<S, A>(
  1. S initialState,
  2. Reducer<S, A, EmptyEnvironment> reducer
)

Creates a store for reducers that do not need an environment.

This is a convenience constructor equivalent to calling Store.initial with a null environment.

final store = Store.emptyEnvironment(0, counterReducer);

Implementation

static Store<S, A> emptyEnvironment<S, A>(
  S initialState,
  Reducer<S, A, EmptyEnvironment> reducer,
) =>
    Store._(
      subject: CurrentValueSubject.create<S>(initialState),
      reducer: (state, action) => reducer.reduce(state, action, null),
    );