contains method

Future<bool> contains(
  1. FileSystemEntity entity, {
  2. bool recursive = false,
  3. FileSystemEntityPathComparator identical = FileSystemEntity.identicalSync,
})

Checks if this directory contains the entity.

The entity can be a File or a Directory. If recursive is true, it checks the subdirectories too.

Returns a Future<bool> holding the value.

For the sync method, see containsSync.

Implementation

Future<bool> contains(
  FileSystemEntity entity, {
  bool recursive = false,
  FileSystemEntityPathComparator identical = FileSystemEntity.identicalSync,
}) async {
  final entities = list(recursive: recursive);
  return entities.any((element) => identical(entity.path, element.path));
}