checkOrUpdateApp method

Future checkOrUpdateApp()

Implementation

Future checkOrUpdateApp() async {
  try {
    if (CheckPlatform().isAndroid) {
      AppUpdateInfo? updateInfo = await InAppUpdate.checkForUpdate();
      //if( updateInfo==null ) {
        if (updateInfo.updateAvailability == UpdateAvailability.updateAvailable) {
          await InAppUpdate.startFlexibleUpdate();
          return;
        }
      //}
    }
    await checkUpdateOnServer();
    return;
  } on PlatformException catch (ex, trace) {
    if (ex.code == "TASK_FAILURE" && ex.message?.contains("Install Error(-6)") == true) {

    }
    logError(ex, trace: trace, position: 'PlatformException::checkOrUpdateAndroid');
  } catch (ex, trace) {
    logError(ex, trace: trace, position: 'checkOrUpdateAndroid');
  }
  await checkUpdateOnServer();
}