tryFuture<T> static method
Implementation
static Future<Validation<T>> tryFuture<T>(Future<T> Function() f)
=> f().then(Valid)
.catchError((err) {
if (err is Exception) {
return Invalid<T>([Fail.withException(err)]);
}
else if (err is Error)
{
return Invalid<T>([Fail.withError(err)]);
}
return Invalid<T>([Fail.withError(Error())]);
});