exists static method

FutureResult<bool, IoError> exists(
  1. Path path
)

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

Implementation

static FutureResult<bool, IoError> exists(Path path) async {
  return Fs.ioGuard(() async {
    final fsEntity = await FileSystemEntity.type(path.asString());
    return switch (fsEntity) {
      FileSystemEntityType.notFound => false,
      _ => true
    };
  });
}