mapOr<TR> method
TR
mapOr<TR>({
- ResultMapper<
TR> ? pending, - ValueResultMapper<
T, TR> ? initialValue, - ResultMapper<
TR> ? waiting, - ValueResultMapper<
T, TR> ? succeeded, - FailedResultMapper<
TR> ? failed, - ResultMapper<
TR> ? notStarted, - ResultMapper<
TR> ? finished, - ValueResultMapper<
T, TR> ? hasValue, - required ResultMapper<
TR> orElse,
Pattern match the result with else branch
pending
is called with action hasn't started
initialValue
is called when the action isn't started but initialValue is given
waiting
is called when action is in progress
succeeded
is called if result is completed
failed
is called with error and stackTrace if result is failed
notStarted
is called on pending
or initialValue
. Not called if pending
or initialValue
is given.
finished
is either completed or failed. Not called if failed
or succeeded
is given.
hasValue
is called on initialValue
or succeeded
. Not called if initialValue
or succeeded
is given.
orElse
is called if no specific state mapper is given
Implementation
TR mapOr<TR>({
ResultMapper<TR>? pending,
ValueResultMapper<T, TR>? initialValue,
ResultMapper<TR>? waiting,
ValueResultMapper<T, TR>? succeeded,
FailedResultMapper<TR>? failed,
ResultMapper<TR>? notStarted,
ResultMapper<TR>? finished,
ValueResultMapper<T, TR>? hasValue,
required ResultMapper<TR> orElse,
}) =>
unsafeMapOr(
pendingResult: pending,
waitingResult: waiting,
initialValueResult: initialValue,
succeededResult: succeeded,
failedResult: failed,
isNotStarted: notStarted,
isFinished: finished,
hasValue: hasValue,
orElse: orElse,
);