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
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:
Dart Programming Tutorials
- Dart Boolean Tutorial with Examples
- Dart Functions Tutorial with Examples
- Dart Closures Tutorial with Examples
- Dart methods Tutorial and Examples
- Dart Properties Tutorial and Examples
- Dart dot dot ( .. ) operator
- Dart programming with DartPad online tool
- Install Dart SDK on Windows
- Install Visual Studio Code on Windows
- Install Dart Code Extension for Visual Studio Code
- Install Dart Plugin for Android Studio
- Run your first Dart example in Visual Studio Code
- Run your first Dart example in Android Studio
- Parsing JSON with dart:convert
- Dart List Tutorial with Examples
- Dart Variables Tutorial with Examples
- Dart Map Tutorial with Examples
- Dart Loops Tutorial with Examples
- Dart dart_json_mapper Tutorial with Examples
- What is Transpiler?
Show More