extractApiReferences static method

List<String> extractApiReferences(
  1. String text
)

Extract Dart API references from text.

Returns a de-duplicated list in the order they first appear.

Implementation

static List<String> extractApiReferences(String text) {
  final matches = _apiRefPattern.allMatches(text);
  final seen = <String>{};
  final results = <String>[];

  for (final match in matches) {
    final value = match.group(0)!;
    // Filter out common English words that happen to be PascalCase.
    if (_commonWords.contains(value)) continue;
    if (seen.add(value)) {
      results.add(value);
    }
  }

  return results;
}