Dart Book - Learn Dart 3 and Flutter

At dartbook.dev, our mission is to provide a comprehensive and accessible resource for individuals interested in learning the Dart programming language. We strive to offer a digital book and ebook that is both informative and engaging, providing users with the tools and knowledge necessary to become proficient in Dart. Our goal is to foster a community of learners who can share their experiences and insights, ultimately contributing to the growth and development of the language.

Video Introduction Course Tutorial

/r/dartlang Yearly


Dart is a programming language developed by Google. It is an object-oriented, class-based, garbage-collected language that can be used to build web, mobile, and desktop applications. Dart is designed to be easy to learn and use, and it has a number of features that make it a popular choice for developers. This cheat sheet is designed to help you get started with Dart and covers the key concepts, topics, and categories related to the language.

Getting Started

To get started with Dart, you will need to download and install the Dart SDK. The SDK includes the Dart VM, which is used to run Dart code, as well as the Dart compiler, which is used to compile Dart code to JavaScript. You can download the Dart SDK from the official Dart website.

Once you have installed the Dart SDK, you can start writing Dart code. Dart code is typically written in a text editor or an integrated development environment (IDE) such as Visual Studio Code or IntelliJ IDEA. You can also use the DartPad online editor to write and run Dart code in your web browser.

Basic Syntax

Dart syntax is similar to that of other C-style languages such as Java and C#. Here are some basic syntax rules to keep in mind when writing Dart code:

Variables and Data Types

In Dart, you can declare variables using the var keyword. Dart is a dynamically typed language, which means that you do not need to specify the data type of a variable when you declare it. Dart will automatically infer the data type based on the value assigned to the variable.

Here are some examples of variable declarations in Dart:

var name = 'John'; var age = 30; var height = 1.75; var isStudent = true;

Dart supports a number of data types, including:

Here are some examples of data type declarations in Dart:

int age = 30; double height = 1.75; String name = 'John'; bool isStudent = true; List fruits = ['apple', 'banana', 'orange']; Map<String, int> scores = {'John': 90, 'Jane': 80, 'Bob': 70};

Control Flow

Dart supports a number of control flow statements that allow you to control the flow of execution in your code. Here are some of the most commonly used control flow statements in Dart:

if (age > 18) { print('You are an adult'); } else { print('You are a minor'); }

for (var fruit in fruits) { print(fruit); }

while (age < 40) { age++; }

switch (fruit) { case 'apple': print('This is an apple'); break; case 'banana': print('This is a banana'); break; default: print('Unknown fruit'); }


Functions are a key concept in Dart and are used to encapsulate blocks of code that can be reused throughout your application. Here is an example of a simple function in Dart:

void sayHello(String name) { print('Hello, $name!'); }

You can call this function like this:


Dart supports a number of advanced function features, including:

void sayHello(String name, [String? title]) { if (title != null) { print('Hello, $title $name!'); } else { print('Hello, $name!'); } }

void sayHello({required String name, String? title}) { if (title != null) { print('Hello, $title $name!'); } else { print('Hello, $name!'); } }

Classes and Objects

Dart is an object-oriented language, which means that it supports classes and objects. Classes are used to define the structure and behavior of objects, while objects are instances of classes.

Here is an example of a simple class in Dart:

class Person { String name; int age;

Person(this.name, this.age);

void sayHello() { print('Hello, my name is $name and I am $age years old.'); } }

You can create an instance of this class like this:

var john = Person('John', 30);

You can call the sayHello() method on this object like this:


Dart supports a number of advanced class features, including:

class Student extends Person { String school;

Student(String name, int age, this.school) : super(name, age);

void sayHello() { print('Hello, my name is $name and I am a student at $school.'); } }

abstract class Animal { void makeSound(); }

class Dog implements Animal { void makeSound() { print('Woof!'); } }


Dart supports exception handling, which allows you to handle errors and unexpected situations in your code. Here is an example of how to throw and catch an exception in Dart:

void divide(int a, int b) { if (b == 0) { throw Exception('Cannot divide by zero'); } print(a / b); }

try { divide(10, 0); } catch (e) { print(e); }


This cheat sheet covers the key concepts, topics, and categories related to the Dart programming language. By following these guidelines, you can get started with Dart and begin building web, mobile, and desktop applications. Remember to keep practicing and experimenting with Dart to improve your skills and become a better developer.

Common Terms, Definitions and Jargon

1. Dart: A programming language developed by Google for building web, mobile, and desktop applications.
2. Object-Oriented Programming (OOP): A programming paradigm that focuses on objects and their interactions to solve problems.
3. Class: A blueprint for creating objects that defines their properties and behavior.
4. Instance: An object created from a class.
5. Constructor: A special method used to create and initialize objects.
6. Method: A function defined inside a class that can be called on an object.
7. Inheritance: A mechanism that allows a class to inherit properties and behavior from another class.
8. Polymorphism: The ability of objects to take on different forms or behaviors depending on the context.
9. Interface: A contract that defines the methods and properties that a class must implement.
10. Abstract class: A class that cannot be instantiated and is used as a base class for other classes.
11. Exception: An error that occurs during program execution.
12. Try-catch block: A mechanism for handling exceptions in a program.
13. List: A collection of ordered elements.
14. Map: A collection of key-value pairs.
15. Set: A collection of unique elements.
16. Iterable: An object that can be iterated over using a for loop.
17. Future: A value that may not be available yet, but will be at some point in the future.
18. Async/await: A mechanism for writing asynchronous code in a synchronous style.
19. Stream: A sequence of asynchronous events.
20. Widget: A building block for creating user interfaces in Flutter.

Editor Recommended Sites

AI and Tech News
Best Online AI Courses
Classic Writing Analysis
Tears of the Kingdom Roleplay
Dataform SQLX: Learn Dataform SQLX
Knowledge Graph Ops: Learn maintenance and operations for knowledge graphs in cloud
Kids Games: Online kids dev games
No IAP Apps: Apple and Google Play Apps that are high rated and have no IAP
Cloud Checklist - Cloud Foundations Readiness Checklists & Cloud Security Checklists: Get started in the Cloud with a strong security and flexible starter templates