Run your first Dart example in Android Studio
1. Article objective
In this article I'm going to show you how to create a simple Dart example on Android Studio and run it successfully. First and foremost, make sure that you have already installed the Dart Plugin in Android Studio, otherwise you can refer to the following article:
Note that apart from Android Studio, there are a lot of IDE(s) in support of Dart programming, such as Visual Studio Code, IntelliJ IDEA, etc. Thus, the following articles may be useful for you:
2. The first Dart example with Android Studio
First, create the MyFirstDartProject folder.
Secondly, on Android Studio, open the folder you have just created.
- File > Open
Then create a new file:
- File > New > File > MyFirstDart.dart
MyFirstDart.dart
main() {
print("Hello World!");
}
Next, you need to configure to tell Android Studio that this is a Dart project, so offer support to it.
- File > Settings... > Languages / Frameworks > Dart
After that, declare your Dart SDK location.
To run the Dart file on Android Studio you need to add a configuration.
We will create a Configuration to run the Dart file based on an available Template. Select:
- Template > Dart Command Line App > Create configuration
Enter the configuration name and the location of the Dart file.
Now run the Dart file:
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