orElse method

Future<T> orElse(
  1. T fallback
)

Completes with fallback if this future throws.

Example:

final count = await fetchCount().orElse(0);

Implementation

Future<T> orElse(T fallback) => catchError((Object _) => fallback);