showAlertDialog method

dynamic showAlertDialog({
  1. required BuildContext context,
})

This checks the version status, then displays a platform-specific alert onClick buttons can dismiss the update alert, or go to the app store.

Implementation

showAlertDialog({required BuildContext context}) async {
  final AppVersionStatus? versionStatus = await getAppVersionStatus();
  if (minimumVersion != null) {
    // Check if current version is less than minimum version
    if (minimumVersion!.isNotEmpty &&
        versionStatus != null &&
        versionStatus.isMinVersion(minimumVersion!)) {
      showRequiredUpdateAlertDialog(
          context: context, appVersionStatus: versionStatus);
    } else {
      // Check if current version is less than play store/app store version
      if (versionStatus != null && versionStatus.canVersionUpdate) {
        showOptionalUpdateAlertDialog(
            context: context, appVersionStatus: versionStatus);
      }
    }
  }
}