Either<L, R>.tryCatch constructor
Either<L, R>.tryCatch ({
- required R execute(),
- required L onError(
- Object o,
- StackTrace s
Implementation
factory Either.tryCatch({
required R Function() execute,
required L Function(Object o, StackTrace s) onError,
}) {
try {
return Right(execute());
} catch (e, s) {
return Left(onError(e, s));
}
}