sdabet
sdabet

Reputation: 18670

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 ?

Upvotes: 12

Views: 6977

Answers (1)

Alex.F
Alex.F

Reputation: 6181

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;

Upvotes: 7

Related Questions