okaryo.log

Getting the App Version in Flutter | okaryo.log

Getting the App Version in Flutter

    #Flutter

Package to use

Use the package package_info_plus.

Preparation

After installing the package, you need to add the following code before calling runApp().

WidgetsFlutterBinding.ensureInitialized();

How to Use

Now you can use the package.

In addition to the version number, you can also get the build number, app name, and more, as shown below.

PackageInfo packageInfo = await PackageInfo.fromPlatform();

// Version
String version = packageInfo.version;
// Build number
String buildNumber = packageInfo.buildNumber;
// App name
String appName = packageInfo.appName;
// Package name
String packageName = packageInfo.packageName;

Related Posts
Related Posts
Promotion

This site uses Google Analytics.