exclude method
Returns a list of paths from which will be removed elements that match this filter.
Parameters:
list
List of paths.
added
A function that is called whenever an item is added.
removed
A function that is called whenever an item is removed.
Implementation
List<String> exclude(List<String>? list,
{void Function(String path)? added,
void Function(String path)? removed}) {
if (list == null) {
throw ArgumentError.notNull('list');
}
final result = <String>[];
for (var element in list) {
var path = element;
if (_isWindows) {
path = path.replaceAll('\\', '/');
}
if (_onlyDirectory!) {
if (_isDirectory(path)) {
path += '/';
}
}
if (!_glob.match(path)) {
result.add(element);
if (added != null) {
added(path);
}
} else {
if (removed != null) {
removed(path);
}
}
}
return result;
}