list method

List<String>? list(
  1. String directory, {
  2. void notify(
    1. String path
    )?,
})

Lists the directory and returns content of this directory.

Parameters: directory Directory wich will be listed. notify A function that is called whenever an item is added.

Implementation

List<String>? list(String directory, {void Function(String path)? notify}) {
  _files = <String>[];
  if (!_isDirectory(directory)) {
    return _files;
  }

  _notify = notify;
  if (_caseSensitive) {
    if (_isWindows) {
      _useStrict = false;
    } else {
      _useStrict = true;
    }
  } else {
    if (_isWindows) {
      _useStrict = true;
    } else {
      _useStrict = false;
    }
  }

  final isAbsolute = _glob.isAbsolute!;
  if (isAbsolute) {
    _offset = 0;
  } else {
    _offset = directory.length;
  }

  if (isAbsolute) {
    if (_glob.crossesDirectory!) {
      _listAbsoluteWithCrossing(directory);
    } else {
      _listAbsoluteWithoutCrossing(directory);
    }
  } else {
    if (_segments![0].crossesDirectory!) {
      _listRecursive(directory);
    } else {
      _listRelative(directory, 0);
    }
  }

  return _files;
}