Run your first Dart example
in Android Studio

Run your first Dart example
in Android Studio#

https://o7planning.org/13965/dart-programming-with-dartpad-online-tool

View more Tutorials:#

  1. Article objective

  2. The first Dart example with Android Studio

imgFollow us on our fanpages to receive notifications every time there are new articles. img Facebook img Twitter

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.

img

Secondly, on Android Studio, open the folder you have just created.

  • File > Open

img

img

Then create a new file:

  • File > New > File > MyFirstDart.dart

img

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.

img

To run the Dart file on Android Studio you need to add a configuration.

img

We will create a Configuration to run the Dart file based on an available Template. Select:

  • Template > Dart Command Line App > Create configuration

img

Enter the configuration name and the location of the Dart file.

img

Now run the Dart file:

img