map<TResult extends Object?> abstract method
TResult
map<TResult extends Object?>({
- required TResult initial(
- _Initial<
T> value
- _Initial<
- required TResult loading(
- _Loading<
T> value
- _Loading<
- required TResult success(
- _Success<
T> value
- _Success<
- required TResult error(
- _Error<
T> value
- _Error<
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,
});