findAllImports static method

Set<String> findAllImports(
  1. String contents
)

All unique import:package within a large body of text

Implementation

static Set<String> findAllImports(String contents) {
  return importRegex.allMatches(contents).map((m) => m[0]!).toSet();
}