Run your first Dart example in Visual Studio Code
1. Article objective
In this article I'm going to show you how to create a simple Dart example on Visual Studio Code and run it successfully. First and foremost, make sure that you have already installed the Dart Code Extension in Visual Studio Code, otherwise you can refer to the following article:
Note that apart from Visual Studio Code, there are a lot of IDE(s) in support of Dart programming, such as Android Studio, IntelliJ IDEA,etc. Thus, the following articles may be useful for you:
2. Create Project on VS Code
No ADS
On Visual Studio Code press the key combination:
- Cmd + Shift + P (Mac OS)
- Ctrl + Shift + P (Windows)
Select "Dart: New Project".
Next, select "Console Application":
Next, select the folder to store the project to be created, for example:
- C:/DART
Enter the project name:
- myfirstproject
A project has just been created with a sample dart file:
myfirstproject.dart
import 'package:myfirstproject/myfirstproject.dart' as myfirstproject;
void main(List<String> arguments) {
print('Hello world: ${myfirstproject.calculate()}!');
}
To run the dart file, right-click it and select:
- Run Without Debugging
And you will see the result on the DEBUG CONSOLE window:
No ADS
Dart Programming Tutorials
- Dart dot dot ( .. ) operator
- Install Dart Code Extension for Visual Studio Code
- Dart Closures Tutorial with Examples
- Install Dart SDK on Windows
- Install Dart Plugin for Android Studio
- Dart Boolean Tutorial with Examples
- Dart Properties Tutorial and Examples
- Dart List Tutorial with Examples
- Dart dart_json_mapper Tutorial with Examples
- Parsing JSON with dart:convert
- Run your first Dart example in Android Studio
- Dart methods Tutorial and Examples
- Install Visual Studio Code on Windows
- Run your first Dart example in Visual Studio Code
- Dart programming with DartPad online tool
- Dart Variables Tutorial with Examples
- Dart Loops Tutorial with Examples
- Dart Map Tutorial with Examples
- What is Transpiler?
- Dart Functions Tutorial with Examples
Show More