checkForUpdate static method

Future<bool> checkForUpdate({
  1. required String minimumVersionRemoteConfigKey,
  2. String? minimumVersionOverride,
})

Checks if a mandatory update is required for the current platform by comparing the current app version with the minimum required version from Firebase Remote Config.

This function does NOT display any UI and returns the required status immediately. Requires Firebase to be initialized.

Implementation

static Future<bool> checkForUpdate({
  /// [minimumVersionRemoteConfigKey] is the key used to retrieve the minimum required
  /// version string (e.g., '2.5.0') from Firebase Remote Config.
  /// This key MUST be set up in your Firebase Console.
  required String minimumVersionRemoteConfigKey,

  /// [minimumVersionOverride] is an optional value used for local testing
  /// or as an immediate fallback. If [minimumVersionRemoteConfigKey] is not
  /// set in Firebase, the package falls back to this value.
  String? minimumVersionOverride,
}) async {
  // If platform is not Android or iOS, no check is needed.
  if (!Platform.isAndroid && !Platform.isIOS) {
    return false;
  }

  return await _fetchAndCheckVersion(
      minimumVersionOverride, minimumVersionRemoteConfigKey);
}