Set up your first Dart project on Linux

Jermaine Oppong
InstructorJermaine Oppong

Share this video with your friends

Send Tweet
Published 4 years ago
Updated 9 months ago

We will setup our first command-line Dart application. We will use the apt-get package manager on Ubuntu to install the SDK and write our first program. This will prepare you to follow along in the next lessons.

Get the gist of commands →

Instructor: [00:00] We'll begin by running sudo apt-get update to update the package repository listings configured on our system. Install apt transport HTTPS to allow us access to repositories using the HTTPS protocol. Add the Google Linux sign in key to your apt key list to allow us to register the dot repository.

[00:26] You may need to install the curl package if it's not already installed. Then try the command again. Then register the dot repository. This will now allow us to install the dot SDK.

[00:52] To install the development version of the dot SDK, register the unstable dot repo instead. Then run the same command to install dot. You can confirm you have dot installed by going directly to the bin directory. After installing the SDK, add its bin directory to your path environment variable.

[01:15] Now you should be able to use the dot command directly. In your working folder, create a pubspec.yaml file. A pubspec file contains meta data and configuration related to a dot project.

[01:30] We will enter the minimum information about our project such as the name, description, and an author. All starting files go in a bin folder. Let's create one containing a file. In this file we will define a top level function called main. Dot requires this function to start our application. In this function we'll print the current date time. Save the file and run. This completes the lesson.