when<R> method
- {required R data(
- T data
- required R error(
- Object error,
- StackTrace? stackTrace
- required R loading(
Performs an action based on the state of the AsyncValue.
All cases are required, which allows returning a non-nullable value.
Implementation
R when<R>({
required R Function(T data) data,
required R Function(Object error, StackTrace? stackTrace) error,
required R Function() loading,
}) {
return _map(
data: (d) => data(d.value),
error: (e) => error(e.error, e.stackTrace),
loading: (l) => loading(),
);
}