listProjects function

Every project the traversal info selects, in its order (build order by default): exactly the folders a command working on Dart and other language projects visits (BuildBase.traverse), as ListedProjects.

Implementation

Future<List<ListedProject>> listProjects(ProjectTraversalInfo info) async {
  final projects = <ListedProject>[];
  await BuildBase.traverse(
    info: info,
    worksWithNatures: const {DartProjectFolder, LanguageProjectFolder},
    allowUnmatchedProjectPatterns: true,
    run: (context) async {
      final project = ListedProject.fromContext(context);
      if (project != null) projects.add(project);
      return true;
    },
  );
  return projects;
}