errorMessages property Null safety

List<String> errorMessages

Human-readable list of differences between expectedTable and actualTable.

Implementation

List<String> get errorMessages {
  if (expectedTable == null && actualTable != null) {
    return [
      "Table '$actualTable' should NOT exist, but is created by migration files."
    ];
  } else if (expectedTable != null && actualTable == null) {
    return [
      "Table '$expectedTable' should exist, but it is NOT created by migration files."
    ];
  }

  var diffs = _differingColumns.expand((diff) => diff.errorMessages).toList();
  diffs.addAll(uniqueSetDifference?.errorMessages ?? []);

  return diffs;
}