I need to access version from pubspec.yaml and display it in a screen. How can I get this possibly without using any packages. Any answer would be highly appreciated. Thank You
Asked
Active
Viewed 3,463 times
1 Answers
2
Try this package. According to the example, usage is in below.
import 'package:package_info_plus/package_info_plus.dart';
...
// Be sure to add this line if `PackageInfo.fromPlatform()` is called before runApp()
WidgetsFlutterBinding.ensureInitialized();
...
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
Or check this answer

Minjin Gelegdorj
- 691
- 3
- 8