How do you create a Flutter App without the Counter MyApp boilerplate code being created? How do you create a Flutter App without the Counter MyApp boilerplate code being created? flutter flutter

How do you create a Flutter App without the Counter MyApp boilerplate code being created?


No, currently flutter create (and the new project wizards in the IDEs) only create that one example. That's useful in that there are fewer questions asked for new users, who may not have the context to answer a lot of framework questions up front. I think the template is also a good balance between having too much boilerplate code while still providing enough exposure to the framework to be a good pedagogical example.

It likely should borrow a bit of its name from the project name (i.e., hello_world.dart ==> a class name of HelloWorld). For suggestions like that, https://github.com/flutter/flutter/issues/new is the best place to provide feedback.


This is possible now using the following command:

flutter create --sample=material.FloatingActionButton.1 my_demo_app

Here sample can be given a value of a sample id. Some examples can be found at this link (Longer than Stackoverflow's answer limit so can't be copied here)


IntelliJsee how to do it image

sample template for flutter

 import 'package:flutter/material.dart';import 'package:your_app/screens/home.dart';void main() => runApp(new MyApp());class MyApp extends StatelessWidget {  @override  Widget build(BuildContext context) {    return new MaterialApp(      title: 'Navigtion',      routes: <String, WidgetBuilder> {      },      home: new Home(),    );  }}

when you start build your project delete everything in main.dart and type your template abbreviation and hit enter.