isValid method
Checking if file is valid or not
if it was valid then return true
else false
Implementation
@override
bool isValid(String path, String root) {
if (directoryOnly) {
// is directory or link
if (FileSystemEntity.isDirectorySync(path)) {
if (!includeHidden) {
if (isHidden(path, root)) {
return false;
}
return true;
}
return true;
// is file
} else
return false;
} else if (fileOnly) {
// is directory or link
if (FileSystemEntity.isDirectorySync(path)) {
return false;
// is file
} else if (FileSystemEntity.isFileSync(path)) {
if (checkExtension(path)) {
if (!includeHidden) {
if (isHidden(path, root)) {
return false;
}
}
return true;
}
return false;
} else if (FileSystemEntity.isLinkSync(path)) {
return true;
} else {
return false;
}
} else {
// is directory or link
if (path is Directory) {
if (!includeHidden) {
if (isHidden(path, root)) {
return false;
}
return true;
}
return true;
// is file
} else if (path is File) {
if (checkExtension(path)) {
if (!includeHidden) {
if (isHidden(path, root)) {
return false;
}
}
return true;
}
return false;
} else if (path is Link) {
return true;
} else {
return true;
}
}
}