when<R> method
R
when<R>({
- required R data(
- T data
- required R error(
- Object,
- StackTrace?,
- T? previous
- required R loading(
- ProgressType progress,
- T? previous
Implementation
R when<R>({
required R Function(T data) data,
required R Function(Object, StackTrace?, T? previous) error,
required R Function(ProgressType progress, T? previous) loading,
}) {
if (hasError) {
return error(this.error!, stackTrace, this.data);
}
if (connectionState != ConnectionState.done || !hasData) {
return loading(progress!, this.data);
}
return data(this.data!);
}