ioGuardResultSync<T> static method

Result<T, IoError> ioGuardResultSync<T>(
  1. Result<T, IoError> fn()
)

Implementation

static Result<T, IoError> ioGuardResultSync<T>(
    Result<T, IoError> Function() fn) {
  try {
    return fn();
  } on IOException catch (e) {
    return Err(IoError.ioException(e));
  } catch (e) {
    return Err(IoError.unknown(e));
  }
}