Skip to content
Blog

App Versioning in Flutter with package_info_plus

Read your app's version, build number, and installer at runtime with package_info_plus — for update prompts, debug screens, and analytics.

Published on • November 4, 2026

AI Assistant

Users report a bug and you need to know which build they’re running. package_info_plus (v10.2.2 on pub.dev) reads the app’s version, buildNumber, packageName, appName, and installerStore at runtime, on every platform.

Reading package info

import 'package:package_info_plus/package_info_plus.dart';

final info = await PackageInfo.fromPlatform();
print('${info.appName} ${info.version}+${info.buildNumber}');
print('Installed via: ${info.installerStore ?? "unknown"}');

fromPlatform() is async and can be called anywhere; cache the result if you read it often.

Where versioning lives

The values come from native project metadata — pubspec.yaml’s version: field (1.4.2+37) feeds Android’s versionName/versionCode and iOS’s CFBundleShortVersionString/CFBundleVersion. Change the version in pubspec.yaml, rebuild, and package_info_plus reports it.

Common uses

  • Update prompts: compare info.version against a minimum version from your API and show a “New version available” dialog.
  • About screens: display appName version+build so users can copy it into bug reports.
  • Analytics: tag events with the build number to distinguish rollout issues.
Future<bool> _isOutdated(String latest) {
  // Simple numeric comparison; use a semver package for full correctness.
  final current = int.parse(Platform.isAndroid
      ? (await PackageInfo.fromPlatform()).buildNumber
      : (await PackageInfo.fromPlatform()).version.split('.').last);
  return current < int.parse(latest);
}

Web support

On the web, package_info_plus reads from a generated version.json. The docs note you may need to enable CORS headers for that file, and you can also call PackageInfo.setVersion to inject values manually — useful for SPAs where the build pipeline knows the version.

Takeaway: package_info_plus reads version/build/installer metadata at runtime on every platform — use PackageInfo.fromPlatform() for update prompts, about screens, and analytics, keeping pubspec.yaml’s version: field as the single source of truth.