You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[proposal] allow to detect programmatically what flutter version the app was compiled under #61814
Sometimes bugs in a Flutter app are dependent on which version of Flutter the code was compiled with. For this reason, it would be nice to have (or is there a way already) to find out programmatically what version of Flutter my app was compiled with.
Reacted by Bruno Garcia, Peter B, Pascal Welsch, Diego Velásquez, Toooony, Felix Angelov, James Ellis, Hitesh Kumar Saini, fabiancrx, Hosam Hasan Ramadan and 15 more
Hi @atreeon
can I hijack your question as a feature request?
I think this feature would be desirable especially on long term;
wether it would be one line in the pubspec.yaml like created from: 1.17.5,
or just a command to run in terminal.
Thank you
absolutely @iapicca , if its not possible now then adding this as a feature would be great. It would be great to get this programmatically. Something like Platform.version from dart:io that can be used to get the dart version (although that doesn't work in web) during runtime of the app to then show it on an aboutdialog page or something like that.
changed the title [-]How do we programmatically find the flutter version the app was compiled under?[/-][+][proposal] allow to detect programmatically what flutter version the app was compiled under[/+]on Jul 20, 2020
if (globals.platform.environment['FLUTTER_APP_FLAVOR'] !=null) {
throwToolExit('FLUTTER_APP_FLAVOR is used by the framework and cannot be set in the environment.');
}
if (dartDefines.any((String define) => define.startsWith('FLUTTER_APP_FLAVOR'))) {
throwToolExit('FLUTTER_APP_FLAVOR is used by the framework and cannot be '
'set using --${FlutterOptions.kDartDefinesOption} or --${FlutterOptions.kDartDefineFromFileOption}');
}
dartDefines.add('FLUTTER_APP_FLAVOR=$flavor');
The same approach could be used to make the Flutter meta-data available to the app. In the Flutter tool, we know the Flutter version, channel and some other interesting information. It's available via globals.flutterVersion.
Since I've faced a similar problem, I created a dart_flutter_version package that allows you to find out the version of the flutter used to build the program (with some accuracy).
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
iapicca commentedon Jul 20, 2020
Hi @atreeon
can I hijack your question as a feature request?
I think this feature would be desirable especially on long term;
wether it would be one line in the
pubspec.yamllikecreated from: 1.17.5,or just a command to run in terminal.
Thank you
atreeon commentedon Jul 20, 2020
absolutely @iapicca , if its not possible now then adding this as a feature would be great. It would be great to get this programmatically. Something like
Platform.versionfromdart:iothat can be used to get the dart version (although that doesn't work in web) during runtime of the app to then show it on an aboutdialog page or something like that.[-]How do we programmatically find the flutter version the app was compiled under?[/-][+][proposal] allow to detect programmatically what flutter version the app was compiled under[/+]oboobortot commentedon Jan 26, 2023
Not a solution if you don't have flutter installed. Yet mentioning how you can get it on Dev Environments.
I agree it will be best we can get this from the compiled output using introspection (but not mirrors).
markvideon commentedon Mar 12, 2023
This would report the current version of the first available Flutter SDK in the system path, not the version an application was compiled with.
I suppose it could be available as a string constant at runtime after being injected at compile time with some reserved keyword?
e.g.
const appVersion = String.fromEnvironemnt('FLUTTER_VERSION');ueman commentedon Jan 1, 2024
I think (maybe naively) this should be fairly easy to add:
There's already code in the Flutter tool to access the
appFlavorat runtime hereflutter/packages/flutter_tools/lib/src/runner/flutter_command.dart
Lines 1293 to 1301 in 3df4e73
The same approach could be used to make the Flutter meta-data available to the app. In the Flutter tool, we know the Flutter version, channel and some other interesting information. It's available via
globals.flutterVersion.See
flutter/packages/flutter_tools/lib/src/version.dart
Line 82 in 3df4e73
If that's an acceptable way of making it available at runtime to the app, I would attempt to create a PR.
iamsergio commentedon Jun 15, 2024
In my build/deploy scripts I simply:
pro100svitlo commentedon Jan 2, 2025
Hi guys,
Since I've faced a similar problem, I created a dart_flutter_version package that allows you to find out the version of the flutter used to build the program (with some accuracy).
Please let me know what you think 🙏
Make Flutter version information accessible at runtime (#140783)
Reverts "Make Flutter version information accessible at runtime (#140783
Reverts "Make Flutter version information accessible at runtime (#140783
Reland "Make Flutter version information accessible at runtime (#140783…
github-actions commentedon Mar 6, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.