getUpdateMessage static method

Future<String?> getUpdateMessage({
  1. bool forceCheck = false,
})

Get update message to display to user

Implementation

static Future<String?> getUpdateMessage({bool forceCheck = false}) async {
  final latestVersion = await checkForUpdates(forceCheck: forceCheck);
  if (latestVersion == null) return null;

  final currentVersion = FlutterReleaseXKstrings.version;
  final comparison = _compareVersions(currentVersion, latestVersion);

  if (comparison < 0) {
    // Update available
    return '''
📦 A new version of FRX is available!
 Current: $currentVersion
 Latest:  $latestVersion

 Update with: dart pub global activate flutter_release_x
 Or visit: ${FlutterReleaseXKstrings.packageLink}
''';
  } else if (comparison > 0) {
    // Running a newer version (development/pre-release)
    return null;
  } else {
    // Up to date
    return '✅ You are using the latest version of FRX ($currentVersion)';
  }
}