tryParse static method

DVDatabaseServerVersion? tryParse(
  1. String reported
)

The leading major[.minor[.patch]] of what a server reports, or null when there is none.

Null rather than zero: zero reads as a very old server and quietly picks a rule for it.

Implementation

static DVDatabaseServerVersion? tryParse(String reported) {
  final RegExpMatch? match = _leading.firstMatch(reported);
  if (match == null) return null;
  return DVDatabaseServerVersion(
    int.parse(match.group(1)!),
    int.parse(match.group(2) ?? '0'),
    int.parse(match.group(3) ?? '0'),
  );
}