An abstract use case for executing tasks asynchronously via a cubit which
accepts a P
parameter and emits either an L
failed value or an R
success value.
- Inheritance
- Mixed in types
-
- BaseUseCase<
P, L, R>
- BaseUseCase<
Constructors
- Runner()
-
An abstract use case for executing tasks asynchronously via a cubit which
accepts a
P
parameter and emits either anL
failed value or anR
success value.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- leftParams → P?
-
The last params used to execute the use case when it failed.
no setterinherited
- leftValue → L?
-
The last error value emitted by calling run.
no setteroverride
-
params
→ Either<
P, P> ? -
The last params used to execute the use case.
no setterinherited
- rightParams → P?
-
The last params used to execute the use case when it succeeded.
no setterinherited
- rightValue → R?
-
The last success value emitted by calling run.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → RunnerState
-
The current state.
no setterinherited
-
stream
→ Stream<
RunnerState> -
The current stream of states.
no setterinherited
-
value
→ Either<
L, R> ? -
The latest value emitted by calling run which can either reference the
leftValue or the rightValue.
no setteroverride
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
error
which triggers onError with an optional StackTrace.inherited -
close(
) → Future< void> -
Closes the instance.
This method should be called when the instance is no longer needed.
Once close is called, the instance can no longer be used.
inherited
-
distinctEmit(
int actionToken, RunnerState stateCallback()) → RunnerState? -
Updates the Cubit's state based on the
stateCallback
.inherited -
emit(
RunnerState state) → void -
Do not use directly. Instead, use distinctEmit.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCall(
P params) → FutureOr< Either< L, R> > -
The use case action callback.
inherited
-
onChange(
Change< RunnerState> 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 BlocObserver.onError.inherited -
requestNewActionToken(
) → int -
Generates a new action token.
inherited
-
reset(
) → Future< void> -
Clears all the data then emits a RunnerInitial.
override
-
run(
{required P params}) → Future< Either< L, R> ?> - Executes the onCall use case action.
-
setParamsAndValue(
P params, Either< L, R> value) → void -
Sets the
params
andvalue
of the use case.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited