withFallback<T, R> static method
Execute action with fallback if capability not supported Best for: Graceful degradation
Implementation
static Future<R> withFallback<T, R>(
dynamic provider,
Future<R> Function(T) action,
Future<R> Function() fallback,
) async {
if (provider is T) {
return await action(provider);
}
return await fallback();
}