isNewer static method

bool? isNewer(
  1. String candidate,
  2. String base
)

Whether candidate is a newer dotted-numeric version than base. Null when either is unreadable: an unreadable requirement never skips a campaign. Port of iOS GamificationConfig.isNewer(_:than:).

Implementation

static bool? isNewer(String candidate, String base) {
  final newer = _semver(candidate);
  final current = _semver(base);
  if (newer == null || current == null) return null;
  for (var i = 0; i < 3; i++) {
    if (newer[i] != current[i]) return newer[i] > current[i];
  }
  return false;
}