In my previous post I talked about how to Install Flutter & Dart on windows with Visual Studio Code
Now, as our environment is up and running so it's time to create our first app.
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' and you will see 'Flutter: New Project' command suggested in search, like below:
- It will ask you the name for your project, Name it "hello_world"
- Let New Project command execute and then see if you get the project structure just like below:
- Once project is created, then Create one emulator(Good to have it on API level 28-Pie) if you don't have or you can connect to your android device as well.
- When Emulator is up then press F5 on VS Code. It will start executing your application and you should be able to see below hello_world app on Emulator:
- Press '+' button to see the _counter increases it's value.
Congratulation!!!!
You have successfully created your first hello_world App.
Debug your Code
Follow below steps to debug application. for example lets debug code which gets executed when we press '+' button:
- Open File 'Main.Dart' File in your hello_world Application.
- probably on 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.
Comments
Post a Comment