exists function

bool exists(
  1. String path, {
  2. bool followLinks = true,
})

checks if the given path exists.

Throws ArgumentError if path is an empty string.

Implementation

bool exists(String path, {bool followLinks = true}) {
  if (path.isEmpty) {
    throw ArgumentError('path must not be empty.');
  }

  final exists = FileSystemEntity.typeSync(path, followLinks: followLinks) !=
      FileSystemEntityType.notFound;

  return exists;
}