How to Get Build and Version Number of a Flutter App ??

· 2 min read
How to Get Build and Version Number of a Flutter App
How to Get Build and Version Number of a Flutter App

Sometime user needs to display a version of a current mobile application in Flutter in a beta mode. So in this article, we will walk through How to Get Build and Version Number of a Flutter App ??

How to Get Build and Version Number of a Flutter App ??

To get the Build and Version number of a flutter application kindly follow the below steps:

You can use package_info

The versions are extracted from:

Android:

build.gradle, versionCode and versionName

iOS:

Info.plist, CFBundleVersion
  • Add the dependency: Add this to your package’s pubspec.yaml file:
    dependencies:
      package_info: ^0.4.0+16
  • Import the file into your dart file:
    import 'package:package_info/package_info.dart';
  • If your method is marked as async:
    PackageInfo packageInfo = await PackageInfo.fromPlatform();
    
    String appName = packageInfo.appName;
    String packageName = packageInfo.packageName;
    String version = packageInfo.version;
    String buildNumber = packageInfo.buildNumber;
    PackageInfo.fromPlatform().then((PackageInfo packageInfo) {
      String appName = packageInfo.appName;
      String packageName = packageInfo.packageName;
      String version = packageInfo.version;
      String buildNumber = packageInfo.buildNumber;
    });

In this article, We have been through How to Get Build and Version Number of a Flutter App?? 

Thanks for Reading !!! Keep Learning.

Do let us know your valuable feedback to serve you better.

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Leave a Reply