resolveForceUpdate static method

Future<ForceUpdateException?> resolveForceUpdate(
  1. FirebaseRemoteConfigService remoteConfig
)

Checks the installed app version against the minimum required version in remoteConfig and returns a ForceUpdateException if an update is required, or null if the app is up-to-date or no minimum is configured.

Reads the currently activated Remote Config value — callers are responsible for ensuring the config is fresh before calling this method. In the startup sequence RemoteConfigSyncTask provides that guarantee; in the app-resume path DriverLite calls FirebaseRemoteConfigService.fetchAndActivate explicitly before invoking this method.

Free of BuildContext/UI code — callers are responsible for showing the appropriate UI. Used by both the startup sequence (execute) and the app-resume check in DriverLite so version-comparison logic stays centralised.

Implementation

static Future<ForceUpdateException?> resolveForceUpdate(FirebaseRemoteConfigService remoteConfig) async {
  final String minVersion = remoteConfig.getString(RemoteConfigKeys.minVersion);
  if (minVersion.isEmpty) return null;

  final PackageInfo packageInfo = await PackageInfo.fromPlatform();
  final String installedVersion = packageInfo.version;

  if (!AppVersionCheckTask.isVersionBelow(installedVersion, minVersion)) return null;

  return ForceUpdateException(currentVersion: installedVersion, minimumVersion: minVersion);
}