Skip to content

flutter create --platforms drops existing platforms from .metadata #191567

Closed

Description

@ChaserVasya

Disclaimer

The issue was researched and published by AI

Steps to reproduce

flutter create --platforms=android myapp
cd myapp
grep 'platform:' .metadata      # shows: root, android
flutter create --platforms=ios .
grep 'platform:' .metadata      # shows: root, ios  <-- android is gone

Expected result

migration.platforms in .metadata lists root, android, ios — the requested
platform is added to the ones already tracked.

Actual result

The android entry is replaced by ios; the list still has only root + one platform:

 migration:
   platforms:
     - platform: root
       ...
-    - platform: android
+    - platform: ios
       ...

The android/ directory still exists on disk — only its migration tracking is lost, so
flutter migrate no longer knows Android's create_revision / base_revision. .metadata
is marked "should not be manually edited", so there is no supported way to restore it.

Cause (not intentional)

In create_base.dart, .metadata is rebuilt from a fresh empty MigrateConfig() populated
only with the platforms passed to the current --platforms invocation. The existing
.metadata is never read, so any previously tracked platform not repeated in this run is
dropped.

Environment

Flutter 3.32.5 • channel stable • Framework fcf2c11572 (2025-06-24) • Dart 3.8.1
macOS (darwin), project_type: app

Activity

  1. saurabh-mirajkar commented on Aug 24, 2026

    @saurabh-mirajkar
    Contributor

    @ChaserVasya Thanks for the report. I can reproduce this on the latest stable Flutter release (3.47.1). Running flutter create --platforms=<platform> on an existing project rewrites the migration.platforms section in .metadata, replacing previously tracked platforms instead of preserving them. Labelling and routing for further investigation.

  2. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-toolOwned by Flutter Tool team
    and removed
    in triagePresently being triaged by the triage team
    on Aug 24, 2026
  3. Shawn-Yu-Dev commented on Aug 24, 2026

    @Shawn-Yu-Dev
    Contributor

    I've successfully reproduced this issue as well. I suspect the root cause lies within packages/flutter_tools/lib/src/commands/create.dart.
    I will look into it and try to submit a fix.

  4. Shawn-Yu-Dev commented on Aug 24, 2026

    @Shawn-Yu-Dev
    Contributor

    Hi! I'm currently working on a fix for this issue and plan to submit a PR soon.

  5. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Aug 24, 2026
  6. added 2 commits that reference this issue on Aug 25, 2026
    27e7f1b
    5955367
  7. added 2 commits that reference this issue on Sep 2, 2026
    32f1db8
    830d2b8
  8. added a commit that references this issue on Sep 9, 2026
    8dc0ba1
  9. github-actions commented on Sep 23, 2026

    @github-actions

    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.

  10. locked as resolved and limited conversation to collaborators on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listfound in release: 3.47Found to occur in 3.47has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-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