plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

[Bug]: PackageInfoPlus always returns 1.0.0 on windows (web and android works fine)

Open RednibCoding opened this issue 3 years ago • 2 comments
trafficstars

Platform

Windows 10

Plugin

PackageInfoPlus

Version

all from 1.4.0 to ^1.4.3+1

Flutter SDK

=2.16.1 <3.0.0

Steps to reproduce

I just call the initialize method from the code sample and it always returns version 1.0.0 even though the apps version in the pubspec.yaml is different. It works on web and android (without changing a line of code) but on windows it always returns 1.0.0.

Code Sample

static Future<void> initialize() async {
    var packageInfo = await PackageInfo.fromPlatform();
    appState.appName = packageInfo.appName;
    appState.version = packageInfo.version;
    appState.buildNumber = packageInfo.buildNumber;
  }

Logs

I have no problem with errors or exceptions

Flutter Doctor

[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19044.1889], locale de-DE)
    • Flutter version 3.0.1 at D:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (4 months ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at C:\Users\mlb\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.3.0)
    • Visual Studio at D:\Program Files\Microsoft Visual Studio\2022\Professional
    • Visual Studio Professional 2022 version 17.3.32804.467
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] IntelliJ IDEA Community Edition (version 2022.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.71.0)
    • VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.48.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.1889]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 105.0.5195.102
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 105.0.1343.27

[√] HTTP Host Availability
    • All required HTTP hosts are available

RednibCoding avatar Sep 08 '22 20:09 RednibCoding

IIRC there was a discussion about the windows app not using the version in the pubspec as the version for the exe. I can't seem to find it anymore though.

navaronbracke avatar Sep 10 '22 13:09 navaronbracke

That makes sense. The Android implementation works similarly: It reads the app version from the APK, not the pubspec.yaml.

So if the windows.exe is not using the version defined in the pubspec.yml this is more a bug on the Flutter Desktop implementation side than on this plugin.

miquelbeltran avatar Sep 10 '22 20:09 miquelbeltran

I believe this issue can be closed, since this was fixed with Flutter 3.3:

  • https://github.com/flutter/flutter/issues/73652
  • https://github.com/flutter/flutter/pull/106145

ueman avatar Oct 02 '22 14:10 ueman