containsSync method
bool
containsSync(
- FileSystemEntity entity, {
- bool recursive = false,
- 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 bool.
For the async method, see contains.
Implementation
bool containsSync(
FileSystemEntity entity, {
bool recursive = false,
FileSystemEntityPathComparator identical = FileSystemEntity.identicalSync,
}) {
final entities = listSync(recursive: recursive);
return entities.any((element) => identical(entity.path, element.path));
}