isNewVersion method

Future<UpgradeWrapper> isNewVersion()

Returns the upgrade state.

Implementation

Future<UpgradeWrapper> isNewVersion() async {
  try {
    final lastVersion = await getLastVersion();
    final currentVersion = await getCurrentVersion();
    final state = _checkNewVersion(lastVersion, currentVersion)
        ? UpgradeState.upgrade
        : UpgradeState.noUpgrade;
    return UpgradeWrapper(
        state: state,
        lastVersion: lastVersion,
        currentVersion: currentVersion);
  } on Exception catch (exception) {
    return UpgradeWrapper(
        state: UpgradeState.unknown, hasError: true, error: exception);
  }
}