Autoplay

    Setup your first Dart project

    Jermaine OppongJermaine Oppong

    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

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss