displayUpdateAlert static method

dynamic displayUpdateAlert(
  1. BuildContext context, {
  2. required bool forceUpdate,
  3. String? appStoreUrl,
  4. String? iOSDescription,
  5. String? iOSUpdateButtonLabel,
  6. String? iOSCloseButtonLabel,
  7. String? iOSIgnoreButtonLabel,
  8. String? iOSAlertTitle,
  9. String? requireUpdateText,
  10. String? recommendUpdateText,
  11. String? errorText,
  12. String? errorCloseButtonLabel,
  13. String? errorSubtitle,
})

Displaying update alert

Implementation

static displayUpdateAlert(
  BuildContext context, {
  required bool forceUpdate,
  String? appStoreUrl,
  String? iOSDescription,
  String? iOSUpdateButtonLabel,
  String? iOSCloseButtonLabel,
  String? iOSIgnoreButtonLabel,
  String? iOSAlertTitle,
  String? requireUpdateText,
  String? recommendUpdateText,
  String? errorText,
  String? errorCloseButtonLabel,
  String? errorSubtitle,
}) async {
  /// Get current installed version of app
  final PackageInfo info = await PackageInfo.fromPlatform();

  /// Set singleton properties
  _nativeUpdaterInstance._context = context;
  _nativeUpdaterInstance._forceUpdate = forceUpdate;
  _nativeUpdaterInstance._appName = info.appName;
  _nativeUpdaterInstance._appStoreUrl = appStoreUrl;
  _nativeUpdaterInstance._iOSDescription = iOSDescription;
  _nativeUpdaterInstance._iOSUpdateButtonLabel = iOSUpdateButtonLabel;
  _nativeUpdaterInstance._iOSCloseButtonLabel = iOSCloseButtonLabel;
  _nativeUpdaterInstance._iOSIgnoreButtonLabel = iOSIgnoreButtonLabel;
  _nativeUpdaterInstance._iOSAlertTitle = iOSAlertTitle;
  _nativeUpdaterInstance._requireUpdateText = requireUpdateText ?? 'requires that you update to the latest version. You cannot use this app until it is updated.';
  _nativeUpdaterInstance._recommendUpdateText = recommendUpdateText ?? 'recommends that you update to the latest version. You can keep using this app while downloading the update.';
  _nativeUpdaterInstance._errorText = errorText;
  _nativeUpdaterInstance._errorCloseButtonLabel = errorCloseButtonLabel;
  _nativeUpdaterInstance._errorSubtitle = errorSubtitle;
  /// Show the alert based on current platform
  if (Platform.isIOS) {
    _nativeUpdaterInstance._showCupertinoAlertDialog();
  } else {
    _nativeUpdaterInstance._showMaterialAlertDialog();
  }
}