existsSync static method

Result<bool, IoError> existsSync(
  1. Path path
)

Returns Ok(true) if the path points at an existing entity.

Implementation

static Result<bool, IoError> existsSync(Path path) {
  return Fs.ioGuardSync(() {
    final fsEntity = FileSystemEntity.typeSync(path.asString());
    return switch (fsEntity) {
      FileSystemEntityType.notFound => false,
      _ => true
    };
  });
}