allMigrationsByFilePath static method

Map<String, String> allMigrationsByFilePath(
  1. LibraryReader library
)

Find all annotated migrations and bundle them with their source path. Useful for generating an import or list of all migrations.

Implementation

static Map<String, String> allMigrationsByFilePath(LibraryReader library) {
  final annotations = library.annotatedWith(_migrationAnnotationChecker);
  return {
    for (final annotation in annotations)
      '${annotation.element.name}': annotation.element.source!.shortName,
  };
}