Create and Run Dart Console Application Using VSCode?

To run a Dart console application:

  1. Install the Code Runner Extension
  2. Open the Dart code file in Text Editor, then use shortcut Ctrl+Alt+N, or right click the Text Editor and then click Run Code in context menu, the Dart console application will run and the output will be shown in the Output Window.

Steps to run in VS Code:

  • Open Visual Studio Code.
  • Close whatever folder you have open.
  • Make sure you have Dart Code Extension installed, or install it if you don't have it.

enter image description here

  • Press Ctrl + Shift + P on Windows or Cmd + Shift + P on Mac

  • Select Dart: New Project

enter image description here

  • Select Console Application

enter image description here

  • Type in a name, example: hello_world
  • Hit Enter
  • Select a folder that already exists.
  • Wait until it finishes

enter image description here

  • main.dart file will show up.

  • Hit Ctrl + F5 to run or Run, Run without debugging.

  • In the Debug Console window, you will see the result.

enter image description here


There is an easy way to create and run a Dart console application:

  1. Open VSCode

  2. Press cmd + shift + p on Mac or ctrl + shift + p on windows.

  3. Choose Dart: New project

enter image description here

4.Then you should select Console Application

enter image description here

5.After locating console application everything is ready for you 😊

Well, how to run it? So easy!!!🙂

Just go to terminal and type: "dart main.dart"

or copy the main.dart path then type: "dart (paste main file path)"

or press ctrl + F5

enter image description here

That's it. I hope you enjoy. 😁

Tags:

Dart