Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access app version in Flutter Web?

In a Flutter app there is a version attribute in the pubspec.yaml file to specify the app version.

Is it possible to access this value from dart code when building for the web ?

like image 273
sdabet Avatar asked Jan 09 '20 08:01

sdabet


People also ask

How can I tell if Flutter app is running on my website?

You can check whether your Flutter app is running on a web browser by using the kIsWeb constant from the foundation library. You can find more information about the foundation library in Flutter's official documentation.

Can Flutter apps run on web?

Yes. Flutter is great for both mobile and web app development as it is highly compatible with current-generation web rendering technologies like HTML, CSS, and JavaScript. Using Flutter, you can easily compile the existing code into a client experience, embed it into the browser, and then deploy it to any web server.


1 Answers

There is now package_info_plus

That supports flutter for web and other platforms

Usage

import 'package:package_info_plus/package_info_plus.dart';

PackageInfo packageInfo = await PackageInfo.fromPlatform();

String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
like image 168
Alex.F Avatar answered Sep 21 '22 13:09

Alex.F