Bloc<S> constructor

Bloc<S>({
  1. S? initialState,
  2. BlocMonitor<Bloc, dynamic> 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 {
  notifyListeners(BlocEventType.init);
  _monitor.onInit(this, _state);
  _isBusy = _state == null;
}