classFilePathsFromAnnotations static method

Map<String, String> classFilePathsFromAnnotations(
  1. Iterable<AnnotatedElement> annotations,
  2. Map<String, String> filesToContents
)

Implementation

static Map<String, String> classFilePathsFromAnnotations(
  Iterable<AnnotatedElement> annotations,
  Map<String, String> filesToContents,
) {
  return {
    for (final annotation in annotations)
      '${annotation.element.name}': filesToContents.entries
          .firstWhere((entry) => entry.value.contains('class ${annotation.element.name} '))
          .key
          // Make relative from the `brick/` folder
          .replaceAll(RegExp('^lib/'), '../'),
  };
}