Skip to content

Flutter CLI ignores pubspec's Flutter features config (like SwiftPM) if current dir is not app's root #176294

@Albert221

Description

@Albert221

Steps:

  1. flutter create test_app --platforms ios and cd test_app
  2. flutter config --enable-swift-package-manager (because majority of my apps use it, or whatever reason)
  3. Add config: enable-swift-package-manager: false to pubspec (with proper indentations of course)
  4. flutter pub add firebase_core
  5. Run flutter pub get. cd ios/
  6. Update the first line of Podfile so that the minimum deployment target is "15.0", and uncomment the line (required by Firebase, unrelated to the bug).
  7. pod install. Check Podfile.lock, it contains the FirebaseCore (because we get it through Cocoapods)
  8. cd ios (or any other directory within the app's directory other than it), run flutter pub get. The config is ignored. Regenerate Podfile from symlinks with pod install. The FirebaseCore was removed from the lock, as it's fetched from SwiftPM now and not Cocoapods 🙃

The lines below sound like they have some knowledge of why it's happening. It should check the manifest of the package closest in the directory tree, not the current directory.

// Can be null if no manifest file exists in the current directory.
final FlutterManifest? _projectManifest;

➜  ~ flutter --version
Flutter 3.35.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 05db968908 (5 weeks ago) • 2025-08-25 10:21:35 -0700
Engine • hash abb725c9a5211af2a862b83f74b7eaf2652db083 (revision a8bfdfc394) (1 months ago) • 2025-08-22 23:51:12.000Z
Tools • Dart 3.9.0 • DevTools 2.48.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listr: fixedIssue is closed as already fixed in a newer versionteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions