How to get build and version number of Flutter app

0 votes

I am currently developing an application which is currently in beta mode. Due to this, I would like to show them what version they are on. For example, "v1.0b10 - iOS". So far, I have got this code: Text("Build: V1.0b10 - " + (Platform.isIOS ? "iOS" : "Android")). How would I be able to get the build version and number within flutter?

Mar 29, 2023 in Flutter by sarit
• 1,830 points
827 views

1 answer to this question.

0 votes

You can get the build and version number of a Flutter app by using the package_info plugin. Here's how to do it:

First, add the package_info plugin to your pubspec.yaml file:

dependencies: package_info: ^2.0.0

Next, import the package_info package in your Dart file:

import 'package:package_info/package_info.dart';

Finally, call the PackageInfo class to get the build and version numbers:

PackageInfo packageInfo = await PackageInfo.fromPlatform(); String version = packageInfo.version; String buildNumber = packageInfo.buildNumber;

Now you can use these variables to display the version and build number in your app. Here's an example:

Text("Build: v$version.$buildNumber - " + (Platform.isIOS ? "iOS" : "Android"))

This will display the version and build number in the format you specified: "v1.0b10 - iOS".

To know more about Flutter, join our Flutter Certification Course today.

answered Mar 29, 2023 by pooja

Related Questions In Flutter

0 votes
1 answer

How to change flutter project name and id?

Yes, it is possible to change the ...READ MORE

answered Mar 20, 2023 in Flutter by pooja
2,883 views
0 votes
1 answer

How can I change the app display name build with Flutter?

Yes, you can change the app display ...READ MORE

answered Mar 21, 2023 in Flutter by venky
2,000 views
0 votes
1 answer

How to Deserialize a list of objects from json in flutter Ask Question?

To deserialize a list of objects from ...READ MORE

answered Mar 28, 2023 in Flutter by vishalini
1,635 views
0 votes
2 answers

Difference between Hadoop 1 and 2

Hadoop V.1.x Components Apache Hadoop V.1.x has the ...READ MORE

answered Aug 28, 2018 in Big Data Hadoop by zombie
• 3,790 points
19,043 views
0 votes
1 answer

How to check the version of Python?

you can check the version of python ...READ MORE

answered Sep 25, 2018 in Python by SDeb
• 13,300 points
622 views
+1 vote
1 answer

How to find out which version of R is loaded

You can use sessionInfo() to accomplish that. > sessionInfo() R version ...READ MORE

answered Nov 8, 2018 in Data Analytics by Maverick
• 10,840 points
452 views
0 votes
1 answer

Consistent versioning in Python project

This is one of the most asked ...READ MORE

answered May 22, 2019 in Python by SDeb
• 13,300 points
615 views
0 votes
1 answer

How to make flutter app responsive according to different screen size?

To make your Flutter app responsive according ...READ MORE

answered Mar 27, 2023 in Flutter by anonymous
6,227 views
0 votes
1 answer

How to find the path of Flutter SDK?

To locate the Flutter SDK, you can ...READ MORE

answered Mar 27, 2023 in Flutter by anonymous
21,932 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP