whenData<R> method
Shorthand for when
to handle only the data
case.
Implementation
AsyncValue<R> whenData<R>(R Function(T value) cb) {
return when(
data: (value) {
try {
return AsyncValue.data(cb(value));
} catch (err, stack) {
return AsyncValue.error(err, stack);
}
},
loading: () => const AsyncValue.loading(),
error: (err, stack) => AsyncValue.error(err, stack),
);
}