CounterBloc constructor

CounterBloc()

The initial state of the CounterBloc is 0.

Implementation

CounterBloc() : super(0) {
  /// When an `Increment` event is added,
  /// the current `state` of the bloc is accessed via the `state` property
  /// and a new state is emitted via `emit`.
  on<Increment>((event, emit) => emit(state + event.amount));
}