map<TResult extends Object?> abstract method

TResult map<TResult extends Object?>({
  1. required TResult initial(
    1. _Initial<T> value
    ),
  2. required TResult loading(
    1. _Loading<T> value
    ),
  3. required TResult success(
    1. _Success<T> value
    ),
  4. required TResult error(
    1. _Error<T> value
    ),
})
override

Achieves the same result as when without destructuring.

map takes five methods as parameters that reflect each remote state. map 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

Implementation

TResult map<TResult extends Object?>({
  required TResult Function(_Initial<T> value) initial,
  required TResult Function(_Loading<T> value) loading,
  required TResult Function(_Success<T> value) success,
  required TResult Function(_Error<T> value) error,
});