tree: 5dc190d6e308f3c49368b4db6f6cb199a9fa0c07 [path history] [tgz]
  1. android/
  2. darwin/
  3. example/
  4. ios/
  5. lib/
  6. macos/
  7. test/
  8. CHANGELOG.md
  9. LICENSE
  10. package_info_android.iml
  11. pubspec.yaml
  12. README.md
packages/package_info/README.md

PackageInfo

This Flutter plugin provides an API for querying information about an application package.

Usage

You can use the PackageInfo to query information about the application package. This works both on iOS and Android.

import 'package:package_info/package_info.dart';

PackageInfo packageInfo = await PackageInfo.fromPlatform();

String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;

Or in async mode:

PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
  String appName = packageInfo.appName;
  String packageName = packageInfo.packageName;
  String version = packageInfo.version;
  String buildNumber = packageInfo.buildNumber;
});

Known Issue

As noted on issue 20761, package_info on iOS requires the Xcode build folder to be rebuilt after changes to the version string in pubspec.yaml. Clean the Xcode build folder with: XCode Menu -> Product -> (Holding Option Key) Clean build folder.

Issues and feedback

Please file issues to send feedback or report a bug. Thank you!