Skip to content

flutter run should auto-create missing platform directories #87292

@gspencergoog

Description

@gspencergoog

We need a way to be able to just have a pubspec.yaml, a lib/main.dart, and perhaps a .metadata file, and be able to flutter run a project from only that. One way to do that would be to have flutter run auto-create the missing platform directory for the platform that the user is attempting to run on, either right in the project directory, or (probably better) in a temp area, perhaps inside the build dir.

The use case is that I'd like to be able to have "bare" projects that don't have any platform directories in them by default, so they can be checked in that way without all the boilerplate, and whenever they are run, they get the latest platform code for the version of Flutter running them.

This won't work for any app that needs customization, of course, but I do think there are a lot of "examples" and simple apps that could benefit from this kind of setup. One place where this would help is to eliminate the stale boilerplate code in the Flutter repo itself, including a bunch of legacy icon binaries that we'd rather not have in the repo in the first place.

Also, if this was the default mode of flutter create, when someone first encounters of a Flutter project, their first impression would be that of something pretty clean and simple, instead of a lot of arcane boilerplate that they probably don't understand or understand the need for (yet).

Some challenges to this proposal would be:

  • It would mean adding a way to write the platform boilerplate in a permanent location so it could be modified.
  • We'd need to make sure that changing the flutter create default behavior doesn't mess up the IDE integrations.
  • Projects that don't support a particular platform will no longer be able to indicate that just by not creating a platform directory for it: Flutter would just attempt to run there and fail.
  • The method of converting from temporary to "permanent" platform directories needs to be discoverable, and we'd need to educate users as to when that is necessary.

I know we used to have something similar, with the .ios and .android ephemeral directories, and we removed them. I can't remember exactly why, but perhaps we can avoid the pitfalls of that?

cc @Hixie @jonahwilliams

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy