onFutureValue<T> method
Race a Future, but only handle successful completion.
Errors from the future are ignored. Use when you only care about successful results and want other branches to handle error cases.
Example:
await XSelect.run<String>((s) => s
..onFutureValue(loadUserData(), (user) => 'User: ${user.name}')
..onFutureValue(loadFallbackData(), (data) => 'Fallback: $data')
..delay(Duration(seconds: 3), () => 'No data available')
);
See also:
- onFuture - Parent
- onFutureError - Only handle error
Implementation
SelectBuilder<R> onFutureValue<T>(Future<T> fut, FutureOr<R> Function(T) body,
{Object? tag, bool Function()? if_}) {
return onFuture<T>(fut.then((value) => value), body, tag: tag, if_: if_);
}