dir function

FileCollection dir(
  1. String directory, {
  2. Set<String> fileExtensions = const {},
  3. Set<String> exclusions = const {},
  4. bool recurse = true,
  5. bool includeHidden = false,
  6. bool allowAbsolutePaths = false,
})

Create a FileCollection consisting of a directory, possibly filtering which files within that directory may be included.

If fileExtensions is not empty, only files with such extensions are resolved.

Files and directory names can be excluded by providing exclusions.

If recurse is set to true (the default), child directories are included.

If includeHidden is set to true (default is false), files and directories starting with a . are included, otherwise they are ignored.

Only relative (to the root project directory) directories are allowed by default. Using absolute paths may cause builds to become unportable.

Implementation

FileCollection dir(
  String directory, {
  Set<String> fileExtensions = const {},
  Set<String> exclusions = const {},
  bool recurse = true,
  bool includeHidden = false,
  bool allowAbsolutePaths = false,
}) =>
    _FileCollection(
        const {},
        List.unmodifiable(_ensureValidDirs([
          DirectoryEntry(
              path: directory,
              fileExtensions: fileExtensions,
              exclusions: exclusions,
              recurse: recurse,
              includeHidden: includeHidden)
        ], allowAbsolutePaths: allowAbsolutePaths)));