listener method

BlocListener<BlocBase, dynamic> listener(
  1. void listener(
    1. BuildContext,
    2. CheckState
    ), {
  2. bool listenWhen(
    1. CheckState,
    2. CheckState
    )?,
  3. required Widget child,
})

Implementation

BlocListener listener(void Function(BuildContext, CheckState) listener,
    {bool Function(CheckState, CheckState)? listenWhen, required Widget child}) {
  return BlocListener<CheckBloc, CheckState>(
    bloc: _checkBloc,
    listener: (BuildContext context, CheckState checkState) {
      listener(context, checkState);
    },
    listenWhen: (CheckState beforeCheckState, CheckState afterCheckState) {
      return listenWhen == null ? true :  listenWhen(beforeCheckState, afterCheckState);
    },
    child: child,
  );
}