showUpdateAlert method

dynamic showUpdateAlert({
  1. required BuildContext context,
  2. String? dialogTitle,
  3. String? dialogText,
  4. String? updateButtonText,
  5. bool? allowDismissal,
  6. String? dismissButtonText,
  7. VoidCallback? dismissAction,
})

Shows the user a platform-specific alert about the app update. The user can dismiss the alert or proceed to the app store.

To change the appearance and behavior of the update dialog, you can optionally provide dialogTitle, dialogText, updateButtonText, allowDismissal, dismissButtonText, and dismissAction parameters.

Implementation

showUpdateAlert({required BuildContext context,
  String? dialogTitle,
  String? dialogText,
  String? updateButtonText,
  bool? allowDismissal,
  String? dismissButtonText,
  VoidCallback? dismissAction}) async {

  final AppVersionStatus? versionStatus = await _getVersionStatus();

  if (versionStatus != null && versionStatus.isUpdateAvailable) {

    _showUpdateDialog(
        context: context,
        versionStatus: versionStatus,
        dialogTitle: dialogTitle,
        dialogText: dialogText,
        updateButtonText: updateButtonText,
        allowDismissal: allowDismissal,
        dismissButtonText: dismissButtonText,
        dismissAction: dismissAction);
  }
}