package_info_plus 3.0.3 copy "package_info_plus: ^3.0.3" to clipboard
package_info_plus: ^3.0.3 copied to clipboard

Flutter plugin for querying information about the application package, such as CFBundleVersion on iOS or versionCode on Android.

PackageInfoPlus #

Flutter Community: package_info_plus

package_info_plus pub points pub package

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

Platform Support #

Android iOS MacOS Web Linux Windows
✔️ ✔️ ✔️ ✔️ ✔️ ✔️

Usage #

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

import 'package:package_info_plus/package_info_plus.dart';

...

// Be sure to add this line if `PackageInfo.fromPlatform()` is called before runApp()
WidgetsFlutterBinding.ensureInitialized();

...

PackageInfo packageInfo = await PackageInfo.fromPlatform();

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

Known Issues #

iOS #

Plugin returns incorrect app version

Flutter build tools allow only digits and . (dot) symbols to be used in version of pubspec.yaml on iOS/MacOS to comply with official version format from Apple.

More info available in this comment

I have changed version in pubspec.yaml and plugin returns wrong info

As noted on issue 20761, package_info_plus 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.

Android (and potentially all platforms) #

Calling to PackageInfo.fromPlatform() before the runApp() call will cause an exception. See https://github.com/fluttercommunity/plus_plugins/issues/309

Learn more #

2346
likes
0
pub points
100%
popularity

Publisher

verified publisherfluttercommunity.dev

Flutter plugin for querying information about the application package, such as CFBundleVersion on iOS or versionCode on Android.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, flutter, flutter_web_plugins, http, meta, package_info_plus_platform_interface, path, win32

More

Packages that depend on package_info_plus