latestMigrationVersion static method

int latestMigrationVersion(
  1. Iterable<Migration> _migrations
)

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

Implementation

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

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