onClose method

  1. @override
void onClose(
  1. BlocBase bloc
)

Called whenever a Bloc is closed. onClose is called just before the Bloc is closed and indicates that the particular instance will no longer emit new states.

Implementation

@override
void onClose(BlocBase bloc) {
  super.onClose(bloc);

  var notify = true;

  if (bloc is FieldBloc && !notifyOnFieldBlocClose) {
    notify = false;
  } else if (bloc is FormBloc && !notifyOnFormBlocClose) {
    notify = false;
  }

  if (notify) {
    child.onClose(bloc);
  }
}