GlobLister constructor
GlobLister(})
Creates the glob lister.
Parameters:
pattern
Pattern of this glob lister.
caseSensitive
True, if the pattern is case sensitive; otherwise false.
exists
Function that determines that the specified path exists or not.
followLinks
True, if lister should follow symbolic links; otherwise false.
isDirectory
Function that determines that the specified path is a directory or not.
isWindows
True, if used the path in the Windows style; otherwise false.
list
Function that lists the specified directory.
Implementation
GlobLister(this.pattern,
{bool? caseSensitive,
bool Function(String path)? exists,
bool followLinks = true,
bool Function(String path)? isDirectory,
bool? isWindows,
List<String> Function(String path, bool? followLinks)? list}) {
if (exists == null) {
throw ArgumentError.notNull('exists');
}
if (isDirectory == null) {
throw ArgumentError.notNull('isDirectory');
}
if (isWindows == null) {
throw ArgumentError.notNull('isWindows');
}
if (list == null) {
throw ArgumentError.notNull('list');
}
if (caseSensitive == null) {
if (isWindows) {
caseSensitive = false;
} else {
caseSensitive = true;
}
}
_caseSensitive = caseSensitive;
_exists = exists;
_followLinks = followLinks;
_isDirectory = isDirectory;
_isWindows = isWindows;
_list = list;
_glob = Glob(pattern, caseSensitive: caseSensitive);
_segments = _glob.segments;
if (_segments!.isNotEmpty) {
_onlyDirectory = _segments!.last.onlyDirectory;
} else {
_onlyDirectory = false;
}
}