Skip to content

Be able to create a new project with prepoluated class names instead of boilerplate project names (MyApp, MyHomePage) #13611

Closed as not planned

Description

@maryx

This is just a feature request.

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';

void main() => runApp(new HelloWorld());

class HelloWorld extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new Container();
  }
}

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.

Activity

  1. sethladd commented on Dec 28, 2017

    @sethladd
    Contributor

    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 :)

  2. Hixie commented on Jan 2, 2018

    @Hixie
    Contributor

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

  3. maryx commented on Jan 2, 2018

    @maryx
    ContributorAuthor

    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.

  4. Hixie commented on Jan 3, 2018

    @Hixie
    Contributor

    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.

  5. maryx commented on Jan 3, 2018

    @maryx
    ContributorAuthor

    Sure, having a blank project can be a separate feature request.

  6. maryx commented on Jan 3, 2018

    @maryx
    ContributorAuthor

    I'll change the title of this one to be to have preopulated class names.

  7. 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
  8. added this to the milestone on Jan 5, 2018
  9. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    and removed
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Apr 23, 2018
  10. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  11. removed this from the milestone on Aug 17, 2020
  12. bkonyi commented on Jun 27, 2025

    @bkonyi
    Contributor

    This is out of scope for the tool as it can be easily accomplished by third party packages (e.g., package:mason supports template based generation).

  13. github-actions commented on Jul 22, 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.

  14. locked as resolved and limited conversation to collaborators on Jul 22, 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

    P2Important issues not at the top of the work listc: 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