latestMigrationVersion static method

int latestMigrationVersion(
  1. Iterable<Migration> allMigrations
)

Sort migrations by their version number in ascending order and return the latest Migration version or 0 if allMigrations is empty

Implementation

static int latestMigrationVersion(Iterable<Migration> allMigrations) {
  if (allMigrations.isEmpty) {
    return 0;
  }

  final versions = allMigrations.map((m) => m.version).toList();
  versions.sort();
  return versions.last;
}