maybeMap<TResult extends Object?> abstract method
TResult
maybeMap<TResult extends Object?>({
- TResult initial(
- _Initial<
T> value
- _Initial<
- TResult loading(
- _Loading<
T> value
- _Loading<
- TResult success(
- _Success<
T> value
- _Success<
- TResult error(
- _Error<
T> value
- _Error<
- required TResult orElse(),
override
Achieves the same result as maybeWhen without destructuring.
maybeMap takes five methods as parameters that reflect each remote state. maybeMap the returned method gets called with a RemoteState state, the method matching the correct state gets called.
initial
determines what to do if the state matches RemoteState.initial
loading
determines what to do if the state matches RemoteState.loading
success
determines what to do if the state matches RemoteState.success
error
determines what to do if the state matches RemoteState.error
orElse
determines what to do if no match is found
Implementation
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial<T> value)? initial,
TResult Function(_Loading<T> value)? loading,
TResult Function(_Success<T> value)? success,
TResult Function(_Error<T> value)? error,
required TResult orElse(),
});