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
No ADS
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:
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