Setup your first Dart project

Jermaine Oppong
InstructorJermaine Oppong

Share this video with your friends

Send Tweet
Published 3 years ago
Updated a month ago

In this lesson, you will setup your first command-line Dart application. We will install the SDK and write our first program. This will form the basis for future lessons where we further explore the Dart ecosystem.

Dart is an object-oriented programming language by Google, which aims to help the developer build modern web applications. It covers client, server and now mobile with Flutter. It comes with a range of tools including a virtual machine, core libraries, and package management repository, lending enough ammunition to start your next project.

Learn more at https://dartlang.org

Instructor: [00:00] Let's install the Dart SDK using Brew on Mac. We will register the Dart repository by running brewTop.-lang/dart. This now enables us to install the SDK. Alternatively, you can install the dev channel version by passing the development flag.

[00:23] Once the SDK is successfully installed, create and open your working folder in your editor of choice. We will begin by creating a pubspec.yaml file. This file contains metadata about a Dart project. We will enter some basic information about our project such as a name, description, and an author.

[00:44] It's conventional to have a bin folder containing our executables. We'll create a bin directory containing our main executable. This will be called main.dart. In this file, we'll create a main function in order for our Dart program to run, and you will print out to the console. Save the file and run.

Jermaine Oppong
Jermaine Opponginstructor
~ 3 years ago

Download the shell script here to automate this here: https://gist.github.com/creativebracket/d692d614f6b0f7d47b45d3e4b9d38b7f