catchingAsync<T> static method
Executes an async function and catches any exceptions, returning them as failures
Implementation
static Future<Result<T, Exception>> catchingAsync<T>(
Future<T> Function() action) async {
try {
return Result.success(await action());
} on Exception catch (e) {
return Result.failure(e);
}
}