FormBlocObserver class
FormBlocObserver hide events
and transitions
of any FieldBloc or FormBloc
from the child.
But the child retains the behavior of the current BlocObserver.
You can customize using:
FormBlocObserver.notifyOnFieldBlocEvent
.FormBlocObserver.notifyOnFieldBlocTransition
.- FormBlocObserver.notifyOnFieldBlocError.
FormBlocObserver.notifyOnFormBlocEvent
.FormBlocObserver.notifyOnFormBlocTransition
.- FormBlocObserver.notifyOnFormBlocError.
Example: final blocObserver = FormBlocObserver( child: MyBlocObserver(), ); BlocOverrides.runZoned(_run, blocObserver: blocObserver)
- Inheritance
-
- Object
- BlocObserver
- FormBlocObserver
Constructors
- FormBlocObserver.new({bool notifyOnFieldBlocCreate = false, bool notifyOnFieldBlocChange = false, bool notifyOnFieldBlocError = true, bool notifyOnFieldBlocClose = false, bool notifyOnFormBlocCreate = false, bool notifyOnFormBlocChange = false, bool notifyOnFormBlocError = true, bool notifyOnFormBlocClose = false, required BlocObserver child})
Properties
- child → BlocObserver
-
The child receives all events
but not those not defined in the FormBlocObserver
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- notifyOnFieldBlocChange → bool
-
If is
true
everychange
of any FieldBloc will be notified to child.final - notifyOnFieldBlocClose → bool
-
If is
true
everyclose
of any FieldBloc will be notified to child.final - notifyOnFieldBlocCreate → bool
-
If is
true
everycreate
of any FieldBloc will be notified to child.final - notifyOnFieldBlocError → bool
-
If is
true
everyerror
of any FieldBloc will be notified to child.final - notifyOnFormBlocChange → bool
-
If is
true
everychange
of any FormBloc will be notified to child.final - notifyOnFormBlocClose → bool
-
If is
true
everyclose
of any FormBloc will be notified to child.final - notifyOnFormBlocCreate → bool
-
If is
true
everycreate
of any FormBloc will be notified to child.final - notifyOnFormBlocError → bool
-
If is
true
everyerror
of any FormBloc will be notified to child.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
BlocBase bloc, Change change) → void -
Called whenever a Change occurs in any
bloc
Achange
occurs when a new state is emitted. onChange is called before a bloc's state has been updated.override -
onClose(
BlocBase bloc) → void -
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.
override
-
onCreate(
BlocBase bloc) → void -
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.
override
-
onError(
BlocBase bloc, Object error, StackTrace stackTrace) → void -
Called whenever an
error
is thrown in any Bloc or Cubit. ThestackTrace
argument may be StackTrace.empty if an error was received without a stack trace.override -
onEvent(
Bloc bloc, Object? event) → void -
Called whenever an
event
isadded
to anybloc
with the givenbloc
andevent
.inherited -
onTransition(
Bloc bloc, Transition transition) → void -
Called whenever a transition occurs in any
bloc
with the givenbloc
andtransition
. Atransition
occurs when a newevent
is added and a new state isemitted
from a corresponding EventHandler. onTransition is called before abloc
's state has been updated.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited