Run your first Dart example on Android Studio

View more Tutorials:

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

View more Tutorials: