getPackages method

PackagesCollection getPackages({
  1. bool recursive = true,
  2. bool withRootPackage = true,
})

Implementation

PackagesCollection getPackages({
  bool recursive = true,
  bool withRootPackage = true,
}) {
  final packagesDirs = getSubDirectories(recursive: recursive);
  final targetDirs = [
    ...packagesDirs,
    if (withRootPackage) workdir,
  ];
  final packages =
      targetDirs.map(PackageProvider.of).whereType<Package>().toList();
  final collection = PackagesCollection(
    packages: packages,
  );

  return collection;
}