Bloc<S> constructor

Bloc<S>({
  1. S? initialState,
  2. BlocMonitor monitor = const BlocEventsPrinter(),
})

initialState is the state which is set at initialization. if its null, the initial state is set to busy.

Implementation

Bloc({S? initialState, BlocMonitor monitor = const BlocEventsPrinter()})
    : _state = initialState,
      _monitor = monitor {
  _monitor.onInit(runtimeType.toString(), _state);
  if (initialState != null) assert(isValueType(initialState));
  if (_state != null) {
    _isBusy = false;
  }
}