startFlexibleUpdate static method

Future<AppUpdateResult> startFlexibleUpdate()

Starts the download of the app update.

Throws a PlatformException if the download fails. When the returned Future is completed without any errors, completeFlexibleUpdate can be called to install the update.

checkForUpdate has to be called first to be able to run this.

Implementation

static Future<AppUpdateResult> startFlexibleUpdate() async {
  try {
    await _channel.invokeMethod('startFlexibleUpdate');
    return AppUpdateResult.success;
  } on PlatformException catch (e) {
    if (e.code == 'USER_DENIED_UPDATE') {
      return AppUpdateResult.userDeniedUpdate;
    } else if (e.code == 'IN_APP_UPDATE_FAILED') {
      return AppUpdateResult.inAppUpdateFailed;
    }

    throw e;
  }
}