plus_plugins
plus_plugins copied to clipboard
[package_info_plus] Wrong version on windows
Hey,
Steps to reproduce: I've set the version to 1.0.22+22 in pubspec yaml...
I use a function to get the version:
Future<String> getAppVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.version;
}
Result: On Android I am getting 1.0.2 On Windows I am getting 1.0.0
Expected: On Windows it should also be 1.0.2
@jpnurmi do you have any idea for this?
I recall it's the version of the .exe, which should be possible to define with CMake.
I've set the version to 1.0.22+22 in pubspec yaml
This doesn't currently do anything for Windows builds; see https://github.com/flutter/flutter/issues/73652
same issue, any solution?
Same here for windows
Everyone will have this behavior on Windows because, per my comment above, that's how Flutter currently works. The version in pubspec.yaml
has no impact on the Windows executable you get from flutter build
, you have to change the version in Runner.rc
.
Is this the same reason for the version now? 1.4.2. Instead of the value 1.0.2 i get 1 only. no decimal. (in windows)
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
The newest ones are already supported and can get the version number correctly
I have a old windows project where this problem occur. Duplication the example project in package_info_plus works okay, but not my old project. This leads me to believe that I must update something in my project. What ???
I have a old windows project where this problem occur. Duplication the example project in package_info_plus works okay, but not my old project. This leads me to believe that I must update something in my project. What ???
Here is the migration guide for you.
Flutter 3.3 added support for setting the Windows app’s version from the pubspec.yaml file or through the --build-name and --build-number build arguments. For more information, refer to the Build and release a Windows app documentation.
Projects created before Flutter version 3.3 need to be migrated to support versioning.
IMHO, and after few test, the problem IS NOT an issue of thi package [package_info_plus] , but the COMPILER used by Flutter.
If you see the details of the .exe with "Windows Explorer", you will see the same number that the [package_info_plus] return.
If you search you will found a lot of thread about the version of Flutter-Windows app and all talk about a runnner.rc
This is fixed now that https://github.com/flutter/flutter/issues/73652 has been fixed, but you'll need to migrate your project by following the instructions here for projects created before Flutter 3.3
I was about to leave an issue.. but I also had the same problem. If you had started a project before Flutter 3.3, then your Windows build will be "stale" and not work with this package "as expected" Getting the version and build from the yaml. You will be saying "It works in Android, but not in Windows." It would be good to document this issue in the package info readme to tell people to upgrade the windows build..
To solve this problem
Delete the windows directory of your project and do the flutter create again.
flutter create --platforms=windows .
You can see this link here https://docs.flutter.dev/platform-integration/windows/version-migration
After doing this, you will then be able to get the desired results.
In any case.. I appreciate this package very much and we ship to 5 Os's. We have a project that was started a while back and had trouble with determining version numbers because we hardcoded it.. and we are lazy to change every time. However, the build number increments are required for app store submission, so we cannot be lazy with that.
It might just be that older projects that started the flutter create with windows only one year ago will be looking for this package_info addon as a solution, yet encounter these same errors. I also suggest a way to place issues a little easier. I did a few things and then realized I would have to compile the example program first.. so I lost my writing and gave up. Compiling the given example program would probably still give me an error, because I often have a project used for compiling sample programs. And if my stub was old enough, that would be an older windows setup.
@bksubhuti Thank you very much for such detailed feedback. I will update the documentation to explicitly mention requirement to migrate.