packageImports method

Iterable<String> packageImports()

Implementation

Iterable<String> packageImports() {
  Iterable<String> extract() sync* {
    Iterable<ServerImports> traverse(ExtractImport import) sync* {
      yield* import.imports.whereType<ServerImports>();

      for (final extractor in import.extractors) {
        if (extractor == null) continue;

        yield* traverse(extractor);
      }
    }

    final imports = traverse(this);

    for (final import in imports) {
      yield* import.packages;
    }
  }

  return _packageImports ??= {...extract().toList()..sort()};
}