Create & Analyze A New Flutter Project

Advertisement

Before starting with the Flutter application Development. Let’s take some time to learn how to create a new Flutter project and analyze the directories and files that come with the new Flutter project.

Create a new Flutter Project

Let’s First create a new Flutter project using the android studio, as it’s simple and beginner-friendly.

Android Studio

  • Open Android Studio IDE.
  • Create a new Flutter project in the android studio by following the path, File → New → New Flutter Project.
  • Select Flutter Application and Click on the Next button.
  • Configure the newly created Flutter application. (Project Name, Flutter SDK Path, Flutter Project location, Description)
  • Configure project. Set the company domain.

Terminal

A new Flutter project can also be created using the terminal command.

$ flutter create my_first_app

The above command creates a Flutter project directory called my_first_app that contains a simple demo app that uses Material Design.

In the project directory, the code for the my_first_app will be present in my_first_app/lib/main.dart.

One point to bear in mind is that the name of the application must not be separated by whitespaces.

Flutter Project Components

 

Flutter Project Components

Let’s take a brief idea about each component:

Android

It holds the complete android project. The android directory also has many sub-directories which is responsible for running our application on an android platform.

 

Flutter Project Android Component

Flutter uses this section to build and store the compiler native machine code for the flutter project.

Build

This holds the application build after the flutter project compilation. This section is managed by the Flutter SDK.

Assets

This directory contains the application assets, such as images, fonts, videos, and so on. This doesn’t come with a new flutter project, we have to create it manually.

IOS

This holds auto-generated source code which is necessary for building iOS apps. The Flutter SDK takes the whole responsibility to build these source files for us.

Lib

The lib is the short form for the library. This directory holds the source-files that the application developers write to create the application.

This is an important directory since we interact with this directory most of the time. The source files in this directory are used to create the source code for the android and iOS sections. Flutter SDK looks at the lib folder and the files inside it to build the flutter application for us that is stored in the build directory.

The newly created flutter project has only one file i.e main.dart file. When creating a scalable application, the code is divided into multiple files and folders:

Flutter lib Component
Flutter Lib Component

Read why flutter uses Dart?

Files

There are some important files that a new flutter project provide us. Let’s take a look:

  • test − Dart code to test the flutter application
  • .gitignore − Git version control file
  • .metadata − auto-generated by the flutter tools
  • .packages − auto-generated to track the flutter packages
  • .iml − project file used by Android studio
  • pubspec.yaml − All the project dependencies are tracked.
  • pubspec.lock − Auto-generated by the Flutter package manager, Pub
  • README.md − Project description file (written in Markdown format)

 

About Author
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Scroll to Top