onCreate method

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

Called whenever a Bloc is instantiated. In many cases, a cubit may be lazily instantiated and onCreate can be used to observe exactly when the cubit instance is created.

Implementation

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

  var notify = true;

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

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