IsolateCubit<Event, State> class
abstract
Takes a Stream
of Events
as input
and transforms them into a Stream
of States
as output.
It must be created:
- from UI with createBloc<Bloc, State> function
or with
IsolateBlocProvider<Bloc, State>()
widget. - from Isolate with getBloc
You shouldn't create in manually and use it standalone.
- Inheritance
-
- Object
- IsolateBlocBase<
Event, State> - IsolateCubit
Constructors
- IsolateCubit(State state)
Properties
- emitted → bool
-
Whether or not first emit is called
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ String?
-
This is bloc's id. Every IsolateBlocBase have it's own unique id used to
communicate with it's own IsolateBlocWrapper.
getter/setter pairinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → State
-
The current state.
no setterinherited
-
stream
→ Stream<
State> -
The current state stream.
no setterinherited
Methods
-
add(
Event event) → void -
Notifies the IsolateBlocBase of a new event and calls onEventReceived.
inherited
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
error
which triggers onError with an optional StackTrace.inherited -
close(
) → Future< void> -
Free all resources. This method should be called when instance is no
longer needed. Once close is called, events that are added will not be
processed.
inherited
-
emit(
State state) → void -
Updates the
state
to the providedstate
. emit does nothing if the instance has been closed or if thestate
being emitted is equal to the currentstate
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< State> change) → void -
Called whenever a
change
occurs with the givenchange
. Achange
occurs when a newstate
is emitted. onChange is called before thestate
of thecubit
is updated. onChange is a great spot to add logging/analytics for a specificcubit
.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
error
occurs and notifies IsolateBlocObserver.onError.inherited -
onEvent(
Event event) → void -
Called whenever an
event
is added to the IsolateBloc. A great spot to add logging/analytics at the individual IsolateBloc level.inherited -
onEventReceived(
Event event) → void -
This function receives events from UI.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited