Table des matières
Exécutez votre premier exemple Dart en Visual Studio Code
View more Tutorials:


Dans cet article, je vous aide à créer un exemple simple de Dart dans Visual Studio Code et l'exécuter avec succès. D'abord, il faut bien installer Dart Code Extension dans Visual Studio Code, sinon, vous pouvez consulter l'article suivant:
Notez qu'en dehors de Visual Studio Code, il existe un grand nombre d' IDE assistant la programmation de Dart, tels que Android Studio, IntelliJ IDEA, etc.. Les articles suivants vous sont donc probablement utiles:
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:

To create a new dart file, right click on the project's "bin" folder and select:
- New File

test.dart
void main() {
print("Hello World!");
}