maybeMap<R> method
R
maybeMap<R>({
- R data(
- AsyncData<
T> data
- AsyncData<
- R error(
- AsyncError<
T> error
- AsyncError<
- R loading(
- AsyncLoading<
T> loading
- AsyncLoading<
- required R orElse(),
Perform some actions based on the state of the AsyncValue, or call orElse if the current state was not tested.
Implementation
R maybeMap<R>({
R Function(AsyncData<T> data)? data,
R Function(AsyncError<T> error)? error,
R Function(AsyncLoading<T> loading)? loading,
required R Function() orElse,
}) {
return _map(
data: (d) {
if (data != null) return data(d);
return orElse();
},
error: (d) {
if (error != null) return error(d);
return orElse();
},
loading: (d) {
if (loading != null) return loading(d);
return orElse();
},
);
}