getCurrentSemVer function

Future<String> getCurrentSemVer()

Gets the current application version exactly as structured in the About screen. Includes VERSION_SUFFIX (e.g., -pr.666 or -daily20260830) so that SemVer pre-release comparisons work correctly.

Implementation

Future<String> getCurrentSemVer() async {
  final packageInfo = await PackageInfo.fromPlatform();
  const suffix = String.fromEnvironment('VERSION_SUFFIX');
  if (suffix.isEmpty) return packageInfo.version;

  final normalizedSuffix = suffix.startsWith('-')
      ? suffix.substring(1)
      : suffix;
  return '${packageInfo.version}-$normalizedSuffix';
}