You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Be able to create a new project with prepoluated class names instead of boilerplate project names (MyApp, MyHomePage) #13611
Using flutter create myapp and File -> New Flutter Project... in Android Studio/IntelliJ both result in the sample code for MyApp (the increment counter app) being created. Could we please have a way to:
instantiate a blank project?
or instantiate something without so much code already written (e.g. see below)?
or something that can customize the name of the app (i.e. if I named my Flutter Application hello_world, MyApp would be called HelloWorld?
Something like:
import'package:flutter/material.dart';
voidmain() =>runApp(newHelloWorld());
classHelloWorldextendsStatelessWidget {
// This widget is the root of your application.@overrideWidgetbuild(BuildContext context) {
returnnewContainer();
}
}
Reasoning:
As a regular developer, the stuff in the sample app may not be relevant (classes would be in different files, comments would be removed). There's a bit of a mental overhead to renaming the classes. Chances are, you'd just delete all the code and start from scratch, so it would be great to have this option when creating a new project.
As a very new developer, one might be more interested in the just StatelessWidgets first (e.g. just how to do visual layouts), and worry about StatefulWidgets (the logic to the app) later.
Reacted by Stephen Fox, Andrea Bittau, Alex Krolick, Tom Oerlemans, Philippe Parisot, Vince Varga and Neil Jay Warner
Eventually we'll need a way for the community to contribute templates and starter projects, because one size doesn't fit all, no matter how many options we offer via the tool.
Imagine a world where community members can contribute templates, and publish those templates to pub. Then imagine the flutter tool can ask pub "list me all the project templates" and offer them as options to the user. The user can then select a starter template, and the flutter tool installs the template package, and then creates an app from the template.
Overall, our goal should be to open up our system for community contributions and create an extensible world. Starter project templates are a good opportunity for that :)
Reacted by Tom Oerlemans and Ibrahim Eid
Reacted by Ibrahim Eid and Ratnadeep Bhattacharyya
@maryx Can you elaborate on why this is needed? For a blank project, you can just create a new project, then select-all and press delete. Isn't that sufficient?
Yep, we could just delete the code. It'd be nice, though, to have the option to start with the blank project, which seems more like a "default", rather than the counter being the "default". For example, many web hosts give you a blank index.html and index.css page rather than a pre-made project. I'm not sure about mobile apps.
I get that most new projects are probably being started by people new to Flutter, so it's a useful reference to have the example app. When we get to the point in the future where most new projects are being started by people already with Flutter experience, it'd be nice to have a blank project option.
Ignoring the above, the most immediately useful feature would be to replace the class names with the name we type in in flutter create <name>. When following the first app tutorial, I expected the boilerplate code to have named my classes, since the directory is already custom-named to . E.g. if I type flutter create weather, a weather dir is created, and I would expect new MyApp(), class MyHomePage etc. to be new WeatherApp() or new Weather(), and class WeatherHomePage.
that wouldn't be black then right? that sounds like a separate feature request.
I think it makes sense to prepopulate the class names; i don't see much value in an actually blank main.dart given how easy it is to make it blank, especially since a black one would immediately report errors.
changed the title [-]Be able to create a blank new project instead of the counter boilerplate project[/-][+]Be able to create a new project with prepoluated class names instead of boilerplate project names (MyApp, MyHomePage)[/+]on Jan 3, 2018
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.
Activity
sethladd commentedon Dec 28, 2017
Eventually we'll need a way for the community to contribute templates and starter projects, because one size doesn't fit all, no matter how many options we offer via the tool.
Imagine a world where community members can contribute templates, and publish those templates to pub. Then imagine the flutter tool can ask pub "list me all the project templates" and offer them as options to the user. The user can then select a starter template, and the flutter tool installs the template package, and then creates an app from the template.
Overall, our goal should be to open up our system for community contributions and create an extensible world. Starter project templates are a good opportunity for that :)
Hixie commentedon Jan 2, 2018
@maryx Can you elaborate on why this is needed? For a blank project, you can just create a new project, then select-all and press delete. Isn't that sufficient?
maryx commentedon Jan 2, 2018
Yep, we could just delete the code. It'd be nice, though, to have the option to start with the blank project, which seems more like a "default", rather than the counter being the "default". For example, many web hosts give you a blank index.html and index.css page rather than a pre-made project. I'm not sure about mobile apps.
I get that most new projects are probably being started by people new to Flutter, so it's a useful reference to have the example app. When we get to the point in the future where most new projects are being started by people already with Flutter experience, it'd be nice to have a blank project option.
Ignoring the above, the most immediately useful feature would be to replace the class names with the name we type in in
flutter create <name>. When following the first app tutorial, I expected the boilerplate code to have named my classes, since the directory is already custom-named to . E.g. if I typeflutter create weather, aweatherdir is created, and I would expectnew MyApp(),class MyHomePageetc. to benew WeatherApp()ornew Weather(), andclass WeatherHomePage.Hixie commentedon Jan 3, 2018
that wouldn't be black then right? that sounds like a separate feature request.
I think it makes sense to prepopulate the class names; i don't see much value in an actually blank main.dart given how easy it is to make it blank, especially since a black one would immediately report errors.
maryx commentedon Jan 3, 2018
Sure, having a blank project can be a separate feature request.
maryx commentedon Jan 3, 2018
I'll change the title of this one to be to have preopulated class names.
[-]Be able to create a blank new project instead of the counter boilerplate project[/-][+]Be able to create a new project with prepoluated class names instead of boilerplate project names (MyApp, MyHomePage)[/+]bkonyi commentedon Jun 27, 2025
This is out of scope for the tool as it can be easily accomplished by third party packages (e.g.,
package:masonsupports template based generation).github-actions commentedon Jul 22, 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.