I need the flutter version and package versions for logging purposes.Is there any way to get this from flutter code or using flutter api's rather than makefile.
-
Does this answer your question? How to get Dart and Flutter version within the appibhavikmakwana– ibhavikmakwana2022-09-26 14:30:14 +00:00Commented Sep 26, 2022 at 14:30
-
1No @ibhavikmakwana the answer suggests to run a script but script needs to be run separately.I am looking for a solution to get these info at runtime.Pushpam– Pushpam2022-09-28 11:01:45 +00:00Commented Sep 28, 2022 at 11:01
Add a comment
|
1 Answer
Use package_info_plus package.
WidgetsFlutterBinding.ensureInitialized();
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
1 Comment
Pushpam
thx! but this gives the app version not the flutter version.