describeMismatches function

String describeMismatches(
  1. List<ResolutionMismatch> mismatches
)

A report naming each drifted package, why the fixture's lock governs, and the repair.

Implementation

String describeMismatches(List<ResolutionMismatch> mismatches) {
  if (mismatches.isEmpty) return '';
  final buffer = StringBuffer()
    ..writeln('${mismatches.length} package(s) resolve differently in the '
        'fixture than in the package it exercises.')
    ..writeln('The fixture reaches that package by `path:`, which supplies its '
        'SOURCE but not its RESOLUTION — so the fixture compiles the '
        "host's current lib/ against these older versions, and the error "
        'surfaces inside a directory the fixture does not own.');
  for (final mismatch in mismatches) {
    buffer.writeln('  - $mismatch');
  }
  buffer.write('Repair: `dart pub get` in the fixture(s) named above.');
  return buffer.toString();
}