Cubix<TState> constructor Null safety

Cubix<TState>(
  1. TState initialState,
  2. [CubitWrapper<TState> create(
    1. TState initialState
    )?]
)

Implementation

Cubix(TState initialState,
    [CubitWrapper<TState> Function(TState initialState)? create])
    : cubit = (create ?? CubitWrapper.new)(initialState) {
  // forward protected event handlers
  cubit.on(
    change: (change) => onChange(Change(
        currentState: change.currentState.state,
        nextState: change.nextState.state)),
    error: onError,
  );
}