importPrefixesOf method

  1. @override
Set<String> importPrefixesOf(
  1. String id
)
inherited

Returns all the prefixes of the imports of a file.

if id is a part file, it returns the prefixes of the imports of the main file.

Implementation

@override
Set<String> importPrefixesOf(String id) {
  final Set<String> prefixes = <String>{};
  String targetSrc = getParentSrc(id);
  for (final List<dynamic> import in importsOf(
    targetSrc,
    includeParts: false,
  )) {
    final String? prefix = import.elementAtOrNull(GraphIndex.directivePrefix);
    if (prefix != null) {
      prefixes.add(prefix);
    }
  }
  return prefixes;
}