recursivePubPath function

Future<List<String>> recursivePubPath(
  1. List<String> dirs, {
  2. List<String>? dependencies,
  3. bool? readConfig,
  4. FilterDartProjectOptions? filterDartProjectOptions,
})

The pub packages found in dirs and below them (dirs included), sorted, without duplicates.

A folder is a package when its pubspec.yaml has an environment: sdk: constraint matching the running dart, or filterDartProjectOptions (ignoreSdkConstraints, minSdk, maxSdk).

if dependencies is specified, it will only list the project that contains such dependency, use either dependency like path, or 'direct:path', 'dev:path' or 'override:path'. readConfig also matches the transitive dependencies (read in the package config, after running pub get when needed).

Hidden folders, build, deploy, node_modules and the test folder of a project are not scanned. Links are followed (reported by their target path), a link to a folder being scanned or above it is not.

for (var path in await recursivePubPath(['.'])) {
  print(path);
}

Implementation

Future<List<String>> recursivePubPath(
  List<String> dirs, {
  List<String>? dependencies,
  bool? readConfig,
  FilterDartProjectOptions? filterDartProjectOptions,
}) => scanPubPath(
  dirs,
  options: IteratePubPathOptions(
    dependencies: dependencies,
    readConfig: readConfig,
    filterDartProjectOptions: filterDartProjectOptions,
  ),
);