Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create and Run Dart Console Application Using VSCode?

Tags:

dart

I can create Flutter new application using VSCode. Now I want to learn Dart programming language.

How can I create and run a Dart console application Using VS Code?

like image 750
rykamol Avatar asked Oct 15 '18 18:10

rykamol


People also ask

Can I code Dart in Vscode?

With the Dart plugin, you can use Visual Studio Code (VS Code) to develop Dart apps. The Flutter site has details on how to set up and use VS Code for Flutter apps.

How do you run Dart program in terminal?

To run the app from the command line, use the Dart VM by running the dart run command in the app's top directory: $ cd cli $ dart run Hello world: 42! If you want to run the app with debugging support, see Dart DevTools.


2 Answers

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. 😁

like image 65
Saeed Avatar answered Oct 06 '22 00:10

Saeed


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.
like image 34
Jun Han Avatar answered Oct 06 '22 01:10

Jun Han