Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The invalidation of pubspec.lock should be better documented on flutter.dev #144730

Closed
Erhannis opened this issue Mar 6, 2024 · 9 comments
Closed
Labels
dependency: dart Dart team may need to help us found in release: 3.19 Found to occur in 3.19 found in release: 3.21 Found to occur in 3.21 has reproducible steps The issue has been confirmed reproducible and is ready to work on r: duplicate Issue is closed as a duplicate of an existing issue team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@Erhannis
Copy link

Erhannis commented Mar 6, 2024

Steps to reproduce

Note that this was initially observed in a gitlab CI environment, then informally reproduced on Windows, and all the following is more painstakingly reproduced on Ubuntu 20.04.6 LTS, 64-bit.

(go to flutter sdk dir)
git checkout 3.16.5
flutter doctor
(go to your projects folder)
flutter create lockfile_bug_test
(copy in pubspec.yaml.txt ; remove .txt extension I added because github didn't want to attach a yaml)
git init
git add .
git commit -m "initial commit"
flutter pub get
git status
(observe pubspec.lock is created)
git add .
git commit -m "flutter pub get"
flutter channel stable
flutter upgrade
git status
(observe no change)
flutter pub get
(note "Changed 8 dependencies!")
git status
(note changed pubspec.lock)

Expected results

As per https://docs.flutter.dev/packages-and-plugins/using-packages , "Flutter saves the concrete package version found in the pubspec.lock lockfile. This ensures that you get the same version again if you, or another developer on your team, run flutter pub get." Therefore, when I flutter pub get, then flutter upgrade, then flutter pub get, the second get should get the dependencies listed in the lockfile, and not alter the lockfile.

Actual results

When I flutter pub get, then flutter upgrade, then flutter pub get, the second get gets different dependencies than are listed in the lockfile, and alters the lockfile. (This caused an error in a CI pipeline we were running.)

Code sample

Code not relevant, aside from the pubspec.yaml I linked in the instructions.

Screenshots or Video

No response

Logs

Logs
erhannis@mnode7:~/tmp$ flutter --version
Flutter 3.19.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7482962148 (8 days ago) • 2024-02-27 16:51:22 -0500
Engine • revision 04817c99c9
Tools • Dart 3.3.0 • DevTools 2.31.1
erhannis@mnode7:~/tmp$ cd /home/erhannis/snap/flutter/common/flutter
erhannis@mnode7:~/snap/flutter/common/flutter$ git checkout 3.16.5
Note: switching to '3.16.5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 78666c8dc5 [flutter release] Update Engine revision to 3f3e560236539b7e2702f5ac790b2a4691b32d49 fo… (#140424)
erhannis@mnode7:~/snap/flutter/common/flutter$ flutter doctor
Downloading Linux x64 Dart SDK from Flutter engine 3f3e560236539b7e2702f5ac790b2a4691b32d49...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  208M  100  208M    0     0  3250k      0  0:01:05  0:01:05 --:--:-- 2360k
Building flutter tool...
Resolving dependencies... (2.0s)
Got dependencies.
Downloading package sky_engine...                                1,754ms
Downloading flutter_patched_sdk tools...                         1,818ms
Downloading flutter_patched_sdk_product tools...                 1,867ms
Downloading linux-x64 tools...                                     11.8s
Downloading linux-x64/font-subset tools...                         335ms
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.16.5, on Ubuntu 20.04.6 LTS 5.15.0-94-generic,
    locale en_US.UTF-8)
    ! Flutter version 3.16.5 on channel [user-branch] at
      /home/erhannis/snap/flutter/common/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official
      channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this
      error.
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
[✓] VS Code (version 1.86.2)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.
erhannis@mnode7:~/snap/flutter/common/flutter$ cd ~/tmp
erhannis@mnode7:~/tmp$ flutter create lockfile_bug_test
Creating project lockfile_bug_test...
Resolving dependencies in lockfile_bug_test... (1.0s)
Got dependencies in lockfile_bug_test.
Wrote 129 files.

All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev

In order to run your application, type:

  $ cd lockfile_bug_test
  $ flutter run

Your application code is in lockfile_bug_test/lib/main.dart.

erhannis@mnode7:~/tmp$ cd lockfile_bug_test
erhannis@mnode7:~/tmp/lockfile_bug_test$ cp ../pubspec.yaml .
erhannis@mnode7:~/tmp/lockfile_bug_test$ git init
Initialized empty Git repository in /home/erhannis/tmp/lockfile_bug_test/.git/
erhannis@mnode7:~/tmp/lockfile_bug_test$ git add .
erhannis@mnode7:~/tmp/lockfile_bug_test$ git commit -m "initial commit"
[master (root-commit) 24db8f2] initial commit
 128 files changed, 4864 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .metadata
 create mode 100644 README.md
 create mode 100644 analysis_options.yaml
 create mode 100644 android/.gitignore
 create mode 100644 android/app/build.gradle
 create mode 100644 android/app/src/debug/AndroidManifest.xml
 create mode 100644 android/app/src/main/AndroidManifest.xml
 create mode 100644 android/app/src/main/kotlin/com/example/lockfile_bug_test/MainActivity.kt
 create mode 100644 android/app/src/main/res/drawable-v21/launch_background.xml
 create mode 100644 android/app/src/main/res/drawable/launch_background.xml
 create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher.png
 create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher.png
 create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
 create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
 create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
 create mode 100644 android/app/src/main/res/values-night/styles.xml
 create mode 100644 android/app/src/main/res/values/styles.xml
 create mode 100644 android/app/src/profile/AndroidManifest.xml
 create mode 100644 android/build.gradle
 create mode 100644 android/gradle.properties
 create mode 100644 android/gradle/wrapper/gradle-wrapper.properties
 create mode 100644 android/settings.gradle
 create mode 100644 ios/.gitignore
 create mode 100644 ios/Flutter/AppFrameworkInfo.plist
 create mode 100644 ios/Flutter/Debug.xcconfig
 create mode 100644 ios/Flutter/Release.xcconfig
 create mode 100644 ios/Runner.xcodeproj/project.pbxproj
 create mode 100644 ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
 create mode 100644 ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
 create mode 100644 ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
 create mode 100644 ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
 create mode 100644 ios/Runner.xcworkspace/contents.xcworkspacedata
 create mode 100644 ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
 create mode 100644 ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
 create mode 100644 ios/Runner/AppDelegate.swift
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
 create mode 100644 ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
 create mode 100644 ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
 create mode 100644 ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
 create mode 100644 ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
 create mode 100644 ios/Runner/Base.lproj/LaunchScreen.storyboard
 create mode 100644 ios/Runner/Base.lproj/Main.storyboard
 create mode 100644 ios/Runner/Info.plist
 create mode 100644 ios/Runner/Runner-Bridging-Header.h
 create mode 100644 ios/RunnerTests/RunnerTests.swift
 create mode 100644 lib/main.dart
 create mode 100644 linux/.gitignore
 create mode 100644 linux/CMakeLists.txt
 create mode 100644 linux/flutter/CMakeLists.txt
 create mode 100644 linux/flutter/generated_plugin_registrant.cc
 create mode 100644 linux/flutter/generated_plugin_registrant.h
 create mode 100644 linux/flutter/generated_plugins.cmake
 create mode 100644 linux/main.cc
 create mode 100644 linux/my_application.cc
 create mode 100644 linux/my_application.h
 create mode 100644 macos/.gitignore
 create mode 100644 macos/Flutter/Flutter-Debug.xcconfig
 create mode 100644 macos/Flutter/Flutter-Release.xcconfig
 create mode 100644 macos/Flutter/GeneratedPluginRegistrant.swift
 create mode 100644 macos/Runner.xcodeproj/project.pbxproj
 create mode 100644 macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
 create mode 100644 macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
 create mode 100644 macos/Runner.xcworkspace/contents.xcworkspacedata
 create mode 100644 macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
 create mode 100644 macos/Runner/AppDelegate.swift
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
 create mode 100644 macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
 create mode 100644 macos/Runner/Base.lproj/MainMenu.xib
 create mode 100644 macos/Runner/Configs/AppInfo.xcconfig
 create mode 100644 macos/Runner/Configs/Debug.xcconfig
 create mode 100644 macos/Runner/Configs/Release.xcconfig
 create mode 100644 macos/Runner/Configs/Warnings.xcconfig
 create mode 100644 macos/Runner/DebugProfile.entitlements
 create mode 100644 macos/Runner/Info.plist
 create mode 100644 macos/Runner/MainFlutterWindow.swift
 create mode 100644 macos/Runner/Release.entitlements
 create mode 100644 macos/RunnerTests/RunnerTests.swift
 create mode 100644 pubspec.lock
 create mode 100644 pubspec.yaml
 create mode 100644 test/widget_test.dart
 create mode 100644 web/favicon.png
 create mode 100644 web/icons/Icon-192.png
 create mode 100644 web/icons/Icon-512.png
 create mode 100644 web/icons/Icon-maskable-192.png
 create mode 100644 web/icons/Icon-maskable-512.png
 create mode 100644 web/index.html
 create mode 100644 web/manifest.json
 create mode 100644 windows/.gitignore
 create mode 100644 windows/CMakeLists.txt
 create mode 100644 windows/flutter/CMakeLists.txt
 create mode 100644 windows/flutter/generated_plugin_registrant.cc
 create mode 100644 windows/flutter/generated_plugin_registrant.h
 create mode 100644 windows/flutter/generated_plugins.cmake
 create mode 100644 windows/runner/CMakeLists.txt
 create mode 100644 windows/runner/Runner.rc
 create mode 100644 windows/runner/flutter_window.cpp
 create mode 100644 windows/runner/flutter_window.h
 create mode 100644 windows/runner/main.cpp
 create mode 100644 windows/runner/resource.h
 create mode 100644 windows/runner/resources/app_icon.ico
 create mode 100644 windows/runner/runner.exe.manifest
 create mode 100644 windows/runner/utils.cpp
 create mode 100644 windows/runner/utils.h
 create mode 100644 windows/runner/win32_window.cpp
 create mode 100644 windows/runner/win32_window.h
erhannis@mnode7:~/tmp/lockfile_bug_test$ flutter pub get
Resolving dependencies... (2.5s)
+ _fe_analyzer_shared 64.0.0 (67.0.0 available)
+ analyzer 6.2.0 (6.4.1 available)
+ args 2.4.2
+ bloc 8.1.3
+ build 2.4.1
+ build_config 1.1.1
+ build_daemon 4.0.1
+ build_resolvers 2.4.2
+ build_runner 2.4.8
+ build_runner_core 7.3.0
+ built_collection 5.1.1
+ built_value 8.9.1
+ checked_yaml 2.0.3
+ code_builder 4.10.0
+ convert 3.1.1
+ cross_file 0.3.3+8 (0.3.4+1 available)
+ crypto 3.0.3
+ dart_style 2.3.6
+ dio 5.4.1
+ dio_response_validator 0.2.3
+ equatable 2.0.5
+ ffi 2.1.0 (2.1.2 available)
+ file 7.0.0
+ fixnum 1.1.0
+ fl_chart 0.65.0 (0.66.2 available)
+ flutter_bloc 8.1.4
> flutter_lints 3.0.1 (was 2.0.3) (from dev dependency to transitive dependency)
+ flutter_web_auth_2 3.1.1
+ flutter_web_auth_2_platform_interface 3.1.0
+ flutter_web_plugins 0.0.0 from sdk flutter
+ freezed 2.4.7
+ freezed_annotation 2.4.1
+ fresh 0.4.2
+ fresh_dio 0.4.1
+ frontend_server_client 3.2.0
+ get_it 7.6.7
+ glob 2.1.2
+ graphs 2.3.1
+ http_multi_server 3.2.1
+ http_parser 4.0.2
+ intl 0.18.1 (0.19.0 available)
+ io 1.0.4
+ js 0.6.7 (0.7.1 available)
+ json_annotation 4.8.1
+ json_serializable 6.7.1
> lints 3.0.0 (was 2.1.1)
+ logger 2.1.0
+ logging 1.2.0
  matcher 0.12.16 (0.12.16+1 available)
  material_color_utilities 0.5.0 (0.8.0 available)
  meta 1.10.0 (1.12.0 available)
+ mime 1.0.5
+ nested 1.0.0
+ package_config 2.1.0
  path 1.8.3 (from transitive dependency to direct dependency) (1.9.0 available)
+ path_provider 2.1.2
+ path_provider_android 2.2.2
+ path_provider_foundation 2.3.2
+ path_provider_linux 2.2.1
+ path_provider_platform_interface 2.1.2
+ path_provider_windows 2.2.1
+ pedantic 1.11.1
+ platform 3.1.4
+ plugin_platform_interface 2.1.8
+ pool 1.5.1
+ popover 0.2.9 (0.3.0 available)
+ provider 6.1.2
+ pub_semver 2.1.4
+ pubspec_parse 1.2.3
+ recase 4.1.0
+ record 5.0.4
+ record_android 1.0.4
+ record_darwin 1.0.1
+ record_linux 0.7.1
+ record_platform_interface 1.0.2
+ record_web 1.0.5
+ record_windows 1.0.2
+ rexios_lints 6.0.1
+ shared_preferences 2.2.2
+ shared_preferences_android 2.2.1
+ shared_preferences_foundation 2.3.5
+ shared_preferences_linux 2.3.2
+ shared_preferences_platform_interface 2.3.2
+ shared_preferences_web 2.2.2 (2.3.0 available)
+ shared_preferences_windows 2.3.2
+ shelf 1.4.1
+ shelf_web_socket 1.0.4
+ source_gen 1.5.0
+ source_helper 1.3.4
+ speech_to_text 6.6.0 (6.6.1 available)
+ speech_to_text_macos 1.1.0
+ speech_to_text_platform_interface 2.2.0
+ sprintf 7.0.0
+ stream_transform 2.1.0
  test_api 0.6.1 (0.7.0 available)
+ timing 1.0.1
+ typed_data 1.3.2
+ url_launcher 6.2.5
+ url_launcher_android 6.3.0
+ url_launcher_ios 6.2.4 (6.2.5 available)
+ url_launcher_linux 3.1.1
+ url_launcher_macos 3.1.0
+ url_launcher_platform_interface 2.3.2
+ url_launcher_web 2.2.3 (2.3.0 available)
+ url_launcher_windows 3.1.1
! uuid 4.0.0-beta3-1 from git https://github.com/erhannis/dart-uuid.git at 262971 (overridden)
+ watcher 1.1.0
  web 0.3.0 (0.5.1 available)
+ web_socket_channel 2.4.0 (2.4.4 available)
+ win32 5.2.0
+ window_to_front 0.0.3
+ xdg_directories 1.0.4
+ yaml 3.1.2
These packages are no longer being depended on:
- cupertino_icons 1.0.6
Changed 108 dependencies!
19 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
erhannis@mnode7:~/tmp/lockfile_bug_test$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   linux/flutter/generated_plugin_registrant.cc
	modified:   linux/flutter/generated_plugins.cmake
	modified:   macos/Flutter/GeneratedPluginRegistrant.swift
	modified:   pubspec.lock
	modified:   windows/flutter/generated_plugin_registrant.cc
	modified:   windows/flutter/generated_plugins.cmake

no changes added to commit (use "git add" and/or "git commit -a")
erhannis@mnode7:~/tmp/lockfile_bug_test$ git add .
erhannis@mnode7:~/tmp/lockfile_bug_test$ git commit -m "flutter pub get"
[master c962fe9] flutter pub get
 6 files changed, 883 insertions(+), 11 deletions(-)
erhannis@mnode7:~/tmp/lockfile_bug_test$ flutter channel stable
Switching to flutter channel 'stable'...

Upgrading engine...
Downloading Linux x64 Dart SDK from Flutter engine 04817c99c9fd4956f27505204f7e344335810aed...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  213M    0 1822k    0     0  2281k      0  0:01:35 --:--:--  0:01:35 2278k
  3  213M    3 8590k    0     0  4653k      0  0:00:47  0:00:01  0:00:46 4651k
  6  213M    6 14.4M    0     0  5277k      0  0:00:41  0:00:02  0:00:39 5275k
  8  213M    8 18.8M    0     0  5077k      0  0:00:43  0:00:03  0:00:40 5076k
 10  213M   10 22.1M    0     0  4682k      0  0:00:46  0:00:04  0:00:42 4681k
 11  213M   11 23.9M    0     0  4228k      0  0:00:51  0:00:05  0:00:46 4539k
 11  213M   11 25.3M    0     0  3813k      0  0:00:57  0:00:06  0:00:51 3500k
 12  213M   12 26.6M    0     0  3502k      0  0:01:02  0:00:07  0:00:55 2510k
 13  213M   13 27.9M    0     0  3224k      0  0:01:07  0:00:08  0:00:59 1833k
 13  213M   13 28.8M    0     0  2958k      0  0:01:14  0:00:09  0:01:05 1338k
 13  213M   13 29.5M    0     0  2798k      0  0:01:18  0:00:10  0:01:08 1134k
 14  213M   14 30.4M    0     0  2644k      0  0:01:22  0:00:11  0:01:11 1050k
 15  213M   15 32.5M    0     0  2600k      0  0:01:24  0:00:12  0:01:12 1192k
 16  213M   16 34.2M    0     0  2544k      0  0:01:26  0:00:13  0:01:13 1324k
 16  213M   16 36.2M    0     0  2511k      0  0:01:27  0:00:14  0:01:13 1581k
 17  213M   17 37.4M    0     0  2425k      0  0:01:30  0:00:15  0:01:15 1619k
 18  213M   18 38.7M    0     0  2360k      0  0:01:32  0:00:16  0:01:16 1691k
 18  213M   18 39.5M    0     0  2181k      0  0:01:40  0:00:18  0:01:22 1251k
 18  213M   18 39.5M    0     0  2139k      0  0:01:42  0:00:18  0:01:24 1049k
 18  213M   18 40.4M    0     0  2081k      0  0:01:45  0:00:19  0:01:26  830k
 19  213M   19 41.5M    0     0  2042k      0  0:01:47  0:00:20  0:01:27  835k
 19  213M   19 42.3M    0     0  1990k      0  0:01:49  0:00:21  0:01:28  743k
 20  213M   20 43.4M    0     0  1915k      0  0:01:54  0:00:23  0:01:31  852k
 20  213M   20 44.0M    0     0  1891k      0  0:01:55  0:00:23  0:01:32  934k
 21  213M   21 45.2M    0     0  1868k      0  0:01:57  0:00:24  0:01:33 1011k
 21  213M   21 46.4M    0     0  1842k      0  0:01:58  0:00:25  0:01:33 1007k
 22  213M   22 47.6M    0     0  1819k      0  0:02:00  0:00:26  0:01:34 1073k
 23  213M   23 49.7M    0     0  1832k      0  0:01:59  0:00:27  0:01:32 1413k
 24  213M   24 52.9M    0     0  1881k      0  0:01:56  0:00:28  0:01:28 1835k
 25  213M   25 55.0M    0     0  1892k      0  0:01:55  0:00:29  0:01:26 2008k
 26  213M   26 57.1M    0     0  1900k      0  0:01:55  0:00:30  0:01:25 2202k
 27  213M   27 58.5M    0     0  1886k      0  0:01:56  0:00:31  0:01:25 2243k
 28  213M   28 60.8M    0     0  1898k      0  0:01:55  0:00:32  0:01:23 2263k
 29  213M   29 63.8M    0     0  1933k      0  0:01:53  0:00:33  0:01:20 2230k
 31  213M   31 66.4M    0     0  1955k      0  0:01:51  0:00:34  0:01:17 2331k
 33  213M   33 71.4M    0     0  2044k      0  0:01:47  0:00:35  0:01:12 2927k
 35  213M   35 76.8M    0     0  2137k      0  0:01:42  0:00:36  0:01:06 3737k
 38  213M   38 81.3M    0     0  2202k      0  0:01:39  0:00:37  0:01:02 4211k
 40  213M   40 87.0M    0     0  2293k      0  0:01:35  0:00:38  0:00:57 4711k
 42  213M   42 89.9M    0     0  2313k      0  0:01:34  0:00:39  0:00:55 4806k
 44  213M   44 94.4M    0     0  2370k      0  0:01:32  0:00:40  0:00:52 4710k
 46  213M   46 99.4M    0     0  2435k      0  0:01:29  0:00:41  0:00:48 4627k
 48  213M   48  104M    0     0  2493k      0  0:01:27  0:00:42  0:00:45 4642k
 51  213M   51  109M    0     0  2551k      0  0:01:25  0:00:43  0:00:42 4581k
 53  213M   53  114M    0     0  2618k      0  0:01:23  0:00:44  0:00:39 5046k
 55  213M   55  118M    0     0  2648k      0  0:01:22  0:00:45  0:00:37 4908k
 58  213M   58  124M    0     0  2703k      0  0:01:20  0:00:46  0:00:34 4865k
 59  213M   59  127M    0     0  2715k      0  0:01:20  0:00:47  0:00:33 4591k
 60  213M   60  128M    0     0  2676k      0  0:01:21  0:00:49  0:00:32 3672k
 60  213M   60  129M    0     0  2670k      0  0:01:21  0:00:49  0:00:32 3136k
 61  213M   61  131M    0     0  2618k      0  0:01:23  0:00:51  0:00:32 2376k
 61  213M   61  131M    0     0  2602k      0  0:01:24  0:00:51  0:00:33 1612k
 62  213M   62  132M    0     0  2576k      0  0:01:24  0:00:52  0:00:32 1198k
 62  213M   62  134M    0     0  2550k      0  0:01:25  0:00:53  0:00:32 1182k
 64  213M   64  137M    0     0  2571k      0  0:01:25  0:00:54  0:00:31 1590k
 65  213M   65  140M    0     0  2579k      0  0:01:24  0:00:55  0:00:29 2133k
 67  213M   67  143M    0     0  2592k      0  0:01:24  0:00:56  0:00:28 2489k
 69  213M   69  149M    0     0  2650k      0  0:01:22  0:00:57  0:00:25 3435k
 72  213M   72  154M    0     0  2684k      0  0:01:21  0:00:58  0:00:23 4119k
 73  213M   73  157M    0     0  2703k      0  0:01:20  0:00:59  0:00:21 4161k
 75  213M   75  162M    0     0  2730k      0  0:01:20  0:01:00  0:00:20 4450k
 77  213M   77  166M    0     0  2758k      0  0:01:19  0:01:01  0:00:18 4672k
 80  213M   80  172M    0     0  2810k      0  0:01:17  0:01:02  0:00:15 4658k
 83  213M   83  178M    0     0  2862k      0  0:01:16  0:01:03  0:00:13 4950k
 86  213M   86  185M    0     0  2924k      0  0:01:14  0:01:04  0:00:10 5570k
 88  213M   88  189M    0     0  2946k      0  0:01:14  0:01:05  0:00:09 5571k
 90  213M   90  193M    0     0  2967k      0  0:01:13  0:01:06  0:00:07 5531k
 93  213M   93  200M    0     0  3023k      0  0:01:12  0:01:07  0:00:05 5697k
 96  213M   96  205M    0     0  3056k      0  0:01:11  0:01:08  0:00:03 5547k
 97  213M   97  208M    0     0  3060k      0  0:01:11  0:01:09  0:00:02 4766k
 99  213M   99  212M    0     0  3069k      0  0:01:11  0:01:10  0:00:01 4682k
100  213M  100  213M    0     0  3077k      0  0:01:11  0:01:11 --:--:-- 4776k
Building flutter tool...
Resolving dependencies...
Got dependencies.
Downloading package sky_engine...                                  761ms
Downloading flutter_patched_sdk tools...                         2,823ms
Downloading flutter_patched_sdk_product tools...                 2,823ms
Downloading linux-x64 tools...                                     23.0s
Downloading linux-x64/font-subset tools...                       1,352ms
Successfully switched to flutter channel 'stable'.
To ensure that you're on the latest build from this channel, run 'flutter upgrade'
erhannis@mnode7:~/tmp/lockfile_bug_test$ flutter upgrade
Flutter is already up to date on channel stable
Flutter 3.19.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7482962148 (8 days ago) • 2024-02-27 16:51:22 -0500
Engine • revision 04817c99c9
Tools • Dart 3.3.0 • DevTools 2.31.1
erhannis@mnode7:~/tmp/lockfile_bug_test$ git status
On branch master
nothing to commit, working tree clean
erhannis@mnode7:~/tmp/lockfile_bug_test$ flutter pub get
Resolving dependencies... (1.3s)
  _fe_analyzer_shared 64.0.0 (67.0.0 available)
  analyzer 6.2.0 (6.4.1 available)
  cross_file 0.3.3+8 (0.3.4+1 available)
  ffi 2.1.0 (2.1.2 available)
  fl_chart 0.65.0 (0.66.2 available)
  intl 0.18.1 (0.19.0 available)
  js 0.6.7 (0.7.1 available)
+ leak_tracker 10.0.0 (10.0.4 available)
+ leak_tracker_flutter_testing 2.0.1 (3.0.3 available)
+ leak_tracker_testing 2.0.1 (3.0.1 available)
> matcher 0.12.16+1 (was 0.12.16)
> material_color_utilities 0.8.0 (was 0.5.0)
> meta 1.11.0 (was 1.10.0) (1.12.0 available)
> path 1.9.0 (was 1.8.3)
  popover 0.2.9 (0.3.0 available)
  shared_preferences_web 2.2.2 (2.3.0 available)
  speech_to_text 6.6.0 (6.6.1 available)
  test_api 0.6.1 (0.7.0 available)
  url_launcher_ios 6.2.4 (6.2.5 available)
  url_launcher_web 2.2.3 (2.3.0 available)
! uuid 4.0.0-beta3-1 from git https://github.com/erhannis/dart-uuid.git at 262971 (overridden)
+ vm_service 13.0.0 (14.1.0 available)
  web 0.3.0 (0.5.1 available)
  web_socket_channel 2.4.0 (2.4.4 available)
Changed 8 dependencies!
20 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
erhannis@mnode7:~/tmp/lockfile_bug_test$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   pubspec.lock

no changes added to commit (use "git add" and/or "git commit -a")
erhannis@mnode7:~/tmp/lockfile_bug_test$ 

Flutter Doctor output

Doctor output

On new version:

erhannis@mnode7:~/tmp/lockfile_bug_test$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.2, on Ubuntu 20.04.6 LTS 5.15.0-94-generic, locale
    en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
[✓] VS Code (version 1.86.2)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

and on old version:

erhannis@mnode7:~/snap/flutter/common/flutter$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.16.5, on Ubuntu 20.04.6 LTS 5.15.0-94-generic,
    locale en_US.UTF-8)
    ! Flutter version 3.16.5 on channel [user-branch] at
      /home/erhannis/snap/flutter/common/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official
      channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this
      error.
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.2)
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2022.1)
[✓] VS Code (version 1.86.2)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.
@Erhannis
Copy link
Author

Erhannis commented Mar 6, 2024

Similar issue here #119091

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Mar 7, 2024
@darshankawar
Copy link
Member

Thanks for the report. I was able to replicate the reported behavior as described in original post.
Note that, without adding any new dependencies in pubspec.yaml, we don't see the reported behavior, but adding the dependencies as mentioned in given pubspec.yaml seems to show the reported error.

Labeling this for tracking and for team's input / attention.

stable, master flutter doctor -v
[!] Flutter (Channel stable, 3.19.2, on macOS 12.2.1 21D62 darwin-x64, locale
    en-GB)
    • Flutter version 3.19.2 on channel stable at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7482962148 (5 days ago), 2024-02-27 16:51:22 -0500
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

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

! Doctor found issues in 1 category.

[!] Flutter (Channel master, 3.21.0-1.0.pre.47, on macOS 12.2.1 21D62
    darwin-x64, locale en-GB)
    • Flutter version 3.21.0-1.0.pre.47 on channel master at
      /Users/dhs/documents/fluttersdk/flutter
    ! Warning: `flutter` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
      your current Flutter SDK checkout at
      /Users/dhs/documents/fluttersdk/flutter. Consider adding
      /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to
      /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
      current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
      Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
      of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f677027655 (87 minutes ago), 2024-03-06 22:57:32 -0500
    • Engine revision 6c1751bd77
    • Dart version 3.4.0 (build 3.4.0-207.0.dev)
    • DevTools version 2.33.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/dhs/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 65.1.4
    • Dart plugin version 213.7228

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.29.0

[✓] Connected device (3 available)
    • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
      • iOS 15.3.1 19D52
    • macOS (desktop)           • macos                                    •
      darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)              • chrome                                   •
      web-javascript • Google Chrome 109.0.5414.119

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
      
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

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

! Doctor found issues in 1 category.



@darshankawar darshankawar added tool Affects the "flutter" command-line tool. See also t: labels. dependency: dart Dart team may need to help us team-tool Owned by Flutter Tool team has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.19 Found to occur in 3.19 found in release: 3.21 Found to occur in 3.21 and removed in triage Presently being triaged by the triage team labels Mar 7, 2024
@mraleph
Copy link
Member

mraleph commented Mar 7, 2024

/cc @sigurdm

@sigurdm
Copy link
Contributor

sigurdm commented Mar 7, 2024

I believe this is due to different flutter versions pinning different files: https://github.com/dart-lang/sdk/wiki/Flutter-Pinned-Packages

This means that the pubspec.lock no longer resolves after changing the dart sdk.

pub get will resolve the current lockfile when possible. Otherwise it will attempt to unlock as few as possible packages as possible to get to a resolution. This is mainly such that adding, removing or changing a constraint in pubspec.yaml leads to an update of pubspec.lock.

For production environements where you want to prevent this from happening you can use:
https://dart.dev/tools/pub/cmd/pub-get#enforce-lockfile

As per https://docs.flutter.dev/packages-and-plugins/using-packages , "Flutter saves the concrete package version found in the pubspec.lock lockfile. This ensures that you get the same version again if you, or another developer on your team, run flutter pub get."

I think this documentation is imprecise, and should be updated. I didn't even know we had pub-specific documentation on flutter.dev - that seems to be overlapping with https://dart.dev/guides/packages#upgrading-a-dependency (which seems to have the same imprecision).

@sigurdm
Copy link
Contributor

sigurdm commented Mar 7, 2024

I opened a separate issue for the documentation updates

@Erhannis
Copy link
Author

Erhannis commented Mar 7, 2024

Thanks; updating the docs to mention "flutter version changes may change the lockfile for reasons X; --enforce-lockfile if you want true 'locking'" sounds like an acceptable resolution. Is it feasible to determine when dependency changes occurred because of a Flutter version change, and mention that in the output of flutter pub get, to help point confused users towards the docs? (It doesn't look like e.g. the lockfile tracks flutter versions directly, but I'm not certain.)

@sigurdm
Copy link
Contributor

sigurdm commented Mar 8, 2024

Is it feasible to determine when dependency changes occurred because of a Flutter version change, and mention that in the output of flutter pub get

Good question. We do have a message if a version resolution fails due to a pinned package.

https://github.com/dart-lang/pub/blob/a42800e5a2f539dd5d86fdc3a6f3beefc971c753/lib/src/solver/incompatibility_cause.dart#L54

But in this case the version resolution doesn't really "fail" (from the solver's perspective) it merely finds a new resolution...

Maybe there is a good way... It is not yet clear to me how we would do it anyways...

@christopherfujino christopherfujino changed the title Flutter upgrade then flutter pub get changes lockfile The invalidation of pubspec.lock should be better documented Mar 12, 2024
@christopherfujino christopherfujino changed the title The invalidation of pubspec.lock should be better documented The invalidation of pubspec.lock should be better documented on flutter.dev Mar 12, 2024
@christopherfujino
Copy link
Member

Thanks, I am closing this in favor of dart-lang/pub#4164

@darshankawar darshankawar added the r: duplicate Issue is closed as a duplicate of an existing issue label Mar 13, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependency: dart Dart team may need to help us found in release: 3.19 Found to occur in 3.19 found in release: 3.21 Found to occur in 3.21 has reproducible steps The issue has been confirmed reproducible and is ready to work on r: duplicate Issue is closed as a duplicate of an existing issue team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

5 participants