Skip to content

Support user-supplied project templates for flutter create #15279

Closed as not planned

Description

@phrohdoh

Proposal

I stumbled upon a boilerplate project today and realized that I'd have to manually clone this and change values in different files and whatnot to get started with it.

Here I propose allowing users to specify a custom template at project creation time.

User Interface

Users creating a new project can specify a template as follows:

# from pub
$ flutter create my-project-name --template package-name-on-pub

# or from a git host
$ flutter create my-project-name --template https://somegithost.com/username/projectname

# or from the local filesystem
$ flutter create my-project-name --template /path/to/project/root

Unanswered Questions

  1. Are substitutions (author name, project name, description, etc) limited to a know set of files?
  2. <your questions / concerns here>

If the answer to 1 is "no" then how will the templating system know which files to modify?

Should it scan all files looking for use of template context data?

Or should the template author explicitly list the files in some form of a manifest?

Alternatives

  1. We don't do this

  2. The flutter CLI could grow a flutter template install (or similar) command.

This would mean creating a directory to house templates (such as ~/.flutter/templates, although ~/.flutter is already a textual file but this could be moved I imagine) and augmenting the template "discovery" code.

  1. <your idea here!>

Activity

  1. phrohdoh commented on Mar 8, 2018

    @phrohdoh
    ContributorAuthor

    This is partially related to, but not a duplicate of, #14719 which is requesting more built-in templates as far as I can tell.

  2. Hixie commented on Jun 5, 2018

    @Hixie
    Contributor

    Why does flutter create need to be involved in this? Can't you just clone a template repo or create a separate tool for generally making template directories, independent of Flutter?

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 5, 2018
  4. phrohdoh commented on Jun 6, 2018

    @phrohdoh
    ContributorAuthor

    You could do that yes, but flutter already has machinery to template out projects, why build another tool that does that just for flutter instead of expanding on the existing tooling that all flutter devs will have?

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 6, 2018
  6. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Aug 26, 2018
  7. modified the milestones: , on Feb 13, 2019
  8. vincevargadev commented on Jul 23, 2019

    @vincevargadev

    I don't think the only issue is that standard installation needs more templates (e.g #14719). There should be a way to share templates with the community or within the organization.

    Users could share simple "seed" projects. The templating concept has multiple names depending on the language which are practically the same thing, like cookie-cutter, scaffolding, boilerplate generation, etc..

    I see many use-cases.

    For example, I want to create small Dart/Flutter libraries, and there are things I always include in my packages: common links in the README, analysis options, my favorite CI tool's YAML file, tools folder, examples for server Dart and in Flutter, benchmark tests, etc....

    Or just imagine someone comes up with a state management pattern that requires some boilerplate code, but it's too much of a hassle to set up every time, every time just a little bit differently as you forget some steps and conventions. People could flutter create --template github.com/hypothetical-dart-programmer/hypothetical_dart_template, and voila, everything works.

    Let's say you are a small dev shop and you can complete simple apps for your clients every couple of weeks. You always start with the tools you like, you select state management, source generation, i18n, navigation, iconset, and you want your custom README to help other developers. With user-supplied templates, this could be achieved.

  9. modified the milestones: , on Jan 7, 2020
  10. ThinkDigitalSoftware commented on Jan 10, 2020

    @ThinkDigitalSoftware
    Contributor

    I like this idea because I don't want to have to keep removing the counter example from a new project but I don't want to burden the dev team with building in my personal preferences. So if we can specify a template project in the settings via path or git remote, then we have unlimited customization potential. What if there was a directory that housed a project we wanted to use as a template? No special syntax necessary. Just copy it to the new directory and we're done.

  11. 7 remaining items

  12. removed this from the milestone on Jun 16, 2020
  13. removed this from the milestone on Jul 7, 2020
  14. removed this from the milestone on Jul 22, 2020
  15. removed this from the milestone on Aug 17, 2020
  16. escamoteur commented on Jan 13, 2021

    @escamoteur
    Contributor

    IMHO this should be directly supported by flutter create because people coming from other tool chains expect something like this, so it's about the first impression people get besides the obvious comfort of first having to activate or install something.

  17. ayushin commented on Sep 28, 2021

    @ayushin

    Is there any work on this?

  18. droplet-js commented on Mar 15, 2022

    @droplet-js

    any news update?

  19. utamori commented on Mar 18, 2022

    @utamori

    This issue is duplicate of #77104

    #77104 (comment)

  20. Pedanfer commented on Jul 22, 2022

    @Pedanfer

    Annoying but not a deal breaker. Definitely could be implemented without much hassle, I think, but perhaps there's a reason it hasn't.

    Let's hope flutter create . --no-sample is available this year. :P

  21. matanlurey commented on Jun 27, 2025

    @matanlurey
    Contributor

    This is not planned, we'd like to see features like this added to packages on pub instead.

  22. github-actions commented on Jul 11, 2025

    @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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityteam-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