isUpdateAvailable property

bool get isUpdateAvailable

Returns true if the store version of the application is greater than the local version.

Implementation

bool get isUpdateAvailable {
  final appLocalVersion = appVersion.split('.').map(int.parse).toList();
  final appStoreVersion = storeVersion.split('.').map(int.parse).toList();

  //Only one comparison needs to return "true" in order to establish that the appStoreVersion version
  // is greater than the appLocalVersion version.
  // This is because each subsequent field in the version notation is less important than
  // the one before it.
  for (var i = 0; i < appStoreVersion.length; i++) {
    if (appStoreVersion[i] > appLocalVersion[i]) {
      return true;
    }
    if (appLocalVersion[i] > appStoreVersion[i]) {
      return false;
    }
  }
  return false;
}