How to create a Flutter web and mobile Application from command line

How to create a Flutter web and mobile Application from command line:

We can create a flutter application from Android studio/IntelliJ, Visual studio code or from the command line directly. In this post, I will show you how to create a Flutter application from the command line.

flutter create command:

You can move to a folder and use the below code to create one App:

flutter create myapp

It will create one new flutter application in a folder myapp in that same folder.

Flutter create terminal

It is a simple demo application that uses Material Components.

Running the app:

The first thing we need to check the devices currently running. For that, we can use the below command:

flutter devices

It prints out the devices those are connected. If you don’t have an Android or iOS simulator/emulator/real device is connected, it will show the chrome.

flutter devices

If I have an Android simulator connected as well, it looks : flutter devices

To run the app, use the below command:

flutter run

It will run it on chrome if there is not connected device. Or you can use :

flutter run -d chrome

flutter web running

Hot reload:

Hot reloading allows us to make any change in the app and reload it without reinstalling it again. It also keeps the state. This makes the development process smooth and fast.

You can also use r to hot reload.

You might also like: