IsolateBlocWrapper<State> class
Takes a Stream
of Events
as input
and transforms them into a Stream
of States
as output using IsolateBlocBase.
It works like a client for IsolateBlocBase. It receives IsolateBlocBase's
states and sends events added by wrapperInstance.add(YourEvent())
. So you can
listen for origin bloc's state with wrapperInstance.listen((state) { })
and add
events as shown above.
It may be created:
- by createBloc function which creates IsolateBlocBase in
Isolate
and returns the instance of this class. - by getBloc function which creates the instance of this class and connects it to the IsolateBlocBase
Don't create this manually!
Constructors
- IsolateBlocWrapper({State? state, required EventReceiver eventReceiver, required IsolateBlocKiller onBlocClose})
-
Takes initialState (
state
), function which receives events and sends them to the IsolateBlocBase and function which called on close and closes IsolateBlocBase which is connected to this wrapper. - IsolateBlocWrapper.isolate(EventReceiver _eventReceiver, IsolateBlocKiller _onBlocClose, [State? state])
- Creates wrapper for getBloc functionality
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isolateBlocId ↔ String?
-
Id of IsolateBloc. It's needed to find bloc in isolate.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → State?
-
Returns the current state of the
bloc
.no setter -
stream
→ Stream<
State> -
Returns the stream of states.
no setter
Methods
-
add(
Object? event) → void - As a result, call original IsolateBloc's add function.
-
close(
) → Future< void> -
Closes the
event
stream and requests to close connected IsolateBlocBase. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onBlocCreated(
) → void - Connects this wrapper to the IsolateBlocBase and sends all unsent events.
-
stateReceiver(
State nextState) → void - Receives IsolateBlocBase's states and adds them to the state Stream.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited