maybeMap<TResult extends Object?> abstract method

TResult maybeMap<TResult extends Object?>({
  1. TResult initial(
    1. _Initial<T> value
    )?,
  2. TResult loading(
    1. _Loading<T> value
    )?,
  3. TResult success(
    1. _Success<T> value
    )?,
  4. TResult error(
    1. _Error<T> value
    )?,
  5. 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(),
});