Skip to content

flutter upgrade fails due to SDK's own pubspec.lock modification (ffigen dependency type changes from direct main to direct dev) #183259

Description

@khusantoy

Steps to reproduce

  1. Have a Flutter project and run any Flutter command that triggers pub resolution (e.g., flutter pub get, flutter run, flutter build)
  2. Navigate to the Flutter SDK directory:
bash   cd $(which flutter)/../..
   git status

  1. Observe that pubspec.lock is marked as modified
  2. Run flutter upgrade

Expected results

flutter upgrade should complete successfully without requiring --force, since the modification to pubspec.lock was made by Flutter itself — not by the user.

Actual results

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these
changes, it is recommended that you stash them via "git stash" or else commit the changes to a local
branch. If it is okay to remove local changes, then re-run this command with "--force".

Running git diff pubspec.lock inside the Flutter SDK directory shows:

diff --git a/pubspec.lock b/pubspec.lock
index 815b5be80ab..01e3568411e 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -219,7 +219,7 @@ packages:
     source: hosted
     version: "2.1.4"
   ffigen:
-    dependency: "direct main"
+    dependency: "direct dev"
     description:
       name: ffigen
       sha256: b7803707faeec4ce3c1b0c2274906504b796e3b70ad573577e72333bd1c9b3ba

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.41.3, on macOS 26.3 25D125 darwin-arm64, locale en-UZ)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.3)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for I.S.K.A.N.D.A.R. Ensure the device is unlocked and
      attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions