isNewerThan static method

bool isNewerThan(
  1. String otherVersion
)

Check if current version is newer than the provided version

Implementation

static bool isNewerThan(String otherVersion) {
  final current = version.split('.');
  final other = otherVersion.split('.');

  for (int i = 0; i < current.length && i < other.length; i++) {
    final currentNum = int.parse(current[i]);
    final otherNum = int.parse(other[i]);

    if (currentNum > otherNum) {
      return true;
    } else if (currentNum < otherNum) {
      return false;
    }
  }

  return current.length > other.length;
}