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
• 3,037 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
• 9,928 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
• 5,567 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
• 4,066 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
• 22,740 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
• 1,894 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
• 2,034 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
• 1,785 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
• 10,080 views
0 votes
1 answer

How to dynamically resize text in Flutter?

You can use the FittedBox widget to ...READ MORE

answered Mar 27, 2023 in Flutter by Tej
• 12,075 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