Skip to content

[bug]: stacked generate formats files under build/ios/SourcePackages with Flutter 3.44 SPM #1189

Description

@codermuss

Describe the bug

When running stacked generate on a Flutter project with Firebase/FlutterFire and Flutter 3.44+ (iOS SPM), the CLI runs dart format . and formats hundreds of third-party Dart files under build/ios/SourcePackages/checkouts/ instead of only the project's own source code.

This makes stacked generate very slow and incorrectly modifies dependency source files inside build/. In some cases, dart format . can also crash with PathNotFoundException when it walks into stale analysis_options.yaml files under build/ (see dart-lang/dart_style#1840).

I'm opening this here because issues are disabled on the Stacked-Org/cli repository.

Root cause: ProcessService.runFormat() in stacked_cli executes dart format . -l <line_length>, which recursively formats everything including build/ios/SourcePackages/checkouts/.

What operating system do you use?

macOS

Information about the installed tooling

[✓] Flutter (Channel stable, 3.44.0, on macOS 26.4.1 25E253 darwin-arm64, locale en-TR) [545ms]
• Flutter version 3.44.0 on channel stable at /Users/codermuss/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 559ffa3f75 (3 weeks ago), 2026-05-15 14:13:13 -0700
• Engine revision 4c525dac5e
• Dart version 3.12.0
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file,
enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [2.9s]
• Android SDK at /Users/codermuss/Library/Android/sdk
• Emulator version 36.5.10.0 (build_id 15081367) (CL:N/A)
• Platform android-36.1, build-tools 36.1.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: flutter config --jdk-dir="path/to/jdk".
• Java version OpenJDK Runtime Environment (build 21.0.10+-117844308-b1163.108)
• All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 26.5) [1,447ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17F42
! CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to
invoke it.
This can usually be fixed by re-installing CocoaPods.
For re-installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation

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

[✓] Connected device (3 available) [6.4s]
• iPhone 17 Pro (mobile) • D49A21C9-8251-4864-B199-0E1867E1750B • ios •
com.apple.CoreSimulator.SimRuntime.iOS-26-5 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 26.4.1 25E253 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 148.0.7778.216

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

Steps to reproduce the issue

Steps to reproduce the issue

  1. Create or open an existing Stacked Flutter project with Firebase/FlutterFire dependencies (e.g. cloud_firestore, firebase_core).
  2. Build or run the iOS app at least once so that build/ios/SourcePackages/checkouts/ is populated (Flutter 3.44+ SPM).
  3. Run stacked generate in the project root.
  4. Observe that after build_runner completes, the CLI runs dart format . -l 80 and formats files under build/ios/SourcePackages/checkouts/flutterfire/... instead of only project source files.

Example output:
Running dart run build_runner build --delete-conflicting-outputs ... [INFO] Succeeded after 461ms with 0 outputs (0 actions) Command complete. ExitCode: 0

Running dart format . -l 80 ... Formatted build/ios/SourcePackages/checkouts/flutterfire/packages/_flutterfire_internals/lib/_flutterfire_internals.dart Formatted build/ios/SourcePackages/checkouts/flutterfire/packages/cloud_firestore/cloud_firestore/lib/src/firestore.dart ... (hundreds more) Command complete. ExitCode: 0

Expected behavior

stacked generate should only format the project's own source directories (e.g. lib/, test/, integration_test/), not files under build/ or third-party dependency checkouts in build/ios/SourcePackages/.

Suggested fix in stacked_cli: change dart format . to dart format lib test integration_test bin (only existing directories).

Screenshots

N/A — terminal output is included in "Steps to reproduce". The issue is reproducible via CLI output showing Formatted build/ios/SourcePackages/checkouts/... paths.

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions