First Android 'Hello World' Application Using Flutter And Dart

If you're new to Flutter and Dart, please make sure to go through my previous article, how to Install Flutter & Dart on Windows with Visual Studio Code.

Now, let's create our first Hello World app. Follow these steps.

Create Project in VS Code

  • Run your VS Code.

  • Run the doctor command to make sure everything is up and running (press Ctrl+shift+p and write doctor, click on suggested Flutter : Run Doctor command). Check the output and make sure you run without any issue. If you face any issue, then go back to my Post and make sure your environment is up and running.

  • Press ctrl+shift+p and type 'New'. You will see the 'Flutter: New Project' command suggested in search, like below.

  • It will ask you to give the name for your project. Name it as "hello_world".
  • Let the New Project command execute and then see if you get the project structure just like below.

  • Once the project is created, Create one emulator (Good to have it on API level 28-Pie) if you don't have or you can connect to yourAndroid device as well.
  • When Emulator is up, press F5 on the VS Code. It will start executing your application and you should be able to see the below hello_world app on Emulator.
  • Press '+' button. You will see that the _counter increases its value.
You have successfully created your first hello_world App. 

Debug your Code

Follow the below steps to debug the application. For example, let's debug the code which gets executed when we press the '+' button. 
  • Open the 'Main.Dart' file in your hello_world application.
  • Probably on the line 49, we have one method _incrementCounter(), Put debug on that line.
  • Press F5 to run the application.
  • Press '+' button which will hit the debug point just like below.

  • Use F10 to step over and F11 to step into.
  • Use Shift+F11 to step out of the code.