Repository navigation
Description
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
- Are substitutions (author name, project name, description, etc) limited to a know set of files?
- <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
-
We don't do this
-
The
flutterCLI could grow aflutter 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.
- <your idea here!>
Activity
phrohdoh commentedon Mar 8, 2018
This is partially related to, but not a duplicate of, #14719 which is requesting more built-in templates as far as I can tell.
Hixie commentedon Jun 5, 2018
Why does
flutter createneed 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?phrohdoh commentedon Jun 6, 2018
You could do that yes, but
flutteralready 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?vincevargadev commentedon Jul 23, 2019
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.
ThinkDigitalSoftware commentedon Jan 10, 2020
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.
HerrNiklasRaab commentedon Feb 8, 2020
Maybe helpful: https://medium.com/flutter-community/flutter-changing-the-default-app-template-f3448386139f
7 remaining items
escamoteur commentedon Jan 13, 2021
IMHO this should be directly supported by
flutter createbecause 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.ayushin commentedon Sep 28, 2021
Is there any work on this?
droplet-js commentedon Mar 15, 2022
any news update?
utamori commentedon Mar 18, 2022
This issue is duplicate of #77104
#77104 (comment)
Pedanfer commentedon Jul 22, 2022
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-sampleis available this year. :Pmatanlurey commentedon Jun 27, 2025
This is not planned, we'd like to see features like this added to packages on pub instead.
github-actions commentedon Jul 11, 2025
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 -vand a minimal reproduction of the issue.