Learn Dart, from your first line to real apps
A free Dart tutorial that goes in order. 105 short lessons across 15 chapters, each with code you can run in the browser and an exercise to try yourself.
Covers Dart 3: null safety, records, patterns and class modifiers. No sign-up.
void main() {
final learners = ['Asha', 'Bikram', 'Chen'];
for (final (i, name) in learners.indexed) {
print('${i + 1}. Welcome, $name!');
}
final total = learners.length;
print('$total people started Dart today.');
}1. Welcome, Asha! 2. Welcome, Bikram! 3. Welcome, Chen! 3 people started Dart today.
The whole course, in order
Start at chapter 1 if you are new to programming. If you already know another language, skim the first three chapters and slow down at null safety.
- 1
Getting Started with Dart
What Dart is, how to install it, and how to write, run and comment your first program.
- 2
Dart Basics
Variables, data types, numbers, strings, booleans, operators and reading input: the building blocks of every Dart program.
- 3
Control Flow
Make decisions with if, else and switch, repeat work with loops, and control exactly when a loop stops or skips.
- 4
Functions
Write reusable blocks of code: parameters, return values, arrow syntax, closures, higher-order functions and recursion.
- 5
Collections
Store and process groups of values with lists, sets and maps, then filter, transform and combine them.
- 6
Null Safety
Understand nullable and non-nullable types, the null-aware operators, and late variables, so null errors are caught before your code runs.
- 7
Object-Oriented Programming
Model real things with classes and objects: constructors, inheritance, interfaces, mixins, enums, generics, extensions and more.
- 8
Records and Patterns
The Dart 3 features that changed everyday code: records, destructuring, pattern matching, switch expressions and sealed classes.
- 9
Error Handling
Deal with things going wrong: catch exceptions with try and catch, clean up with finally, and define your own exception types.
- 10
Asynchronous Programming
Write code that waits without freezing: futures, async and await, streams, the event loop, isolates and generators.
- 11
Files and Directories
Read, write, check and delete files, work with folders and paths, and handle file system errors using the dart:io library.
- 12
Libraries and Packages
Organise code into files and libraries, control what you import, use packages from pub.dev and publish your own.
- 13
Practical Dart
The everyday skills of real projects: JSON, HTTP requests, dates and times, regular expressions, command-line apps and testing.
- 14
Tools and Performance
Format, lint, debug, log and profile your Dart code, and understand how memory and garbage collection work.
- 15
Next Steps
Take your Dart skills further: get started with Flutter, build practice projects, prepare for interviews and keep a cheat sheet handy.
What you will learn in this Dart tutorial #
This Dart tutorial starts from zero and ends with the skills used in real projects. Each lesson explains one idea, shows it in a short program with its output, and finishes with an exercise.
- The fundamentals. Variables, data types, strings, numbers, operators, conditions and loops.
- Functions and collections. Parameters, closures, higher-order functions, lists, sets, maps and the methods that transform them.
- Null safety. How Dart stops null errors before your program runs.
- Object-oriented programming. Classes, constructors, inheritance, interfaces, mixins, enums, generics and extensions.
- Modern Dart 3. Records, patterns, switch expressions, sealed classes and class modifiers.
- Asynchronous code. Futures, async and await, streams, the event loop and isolates.
- Practical skills. Files, JSON, HTTP requests, dates, regular expressions, packages, testing and debugging.
- What comes next. A first look at Flutter, project ideas, interview questions and a cheat sheet.
How to use this site #
Read the lessons in order the first time. Run every example and change it to see what happens: that is where most of the learning takes place. Use the search box, or press /, to jump to a topic. Mark lessons as done to keep track of where you are. Your progress is stored in your own browser and nowhere else.
Questions people ask before starting
What is Dart used for?
Dart is a programming language from Google. It is best known as the language of Flutter, which builds Android, iOS, web and desktop apps from one codebase. Dart is also used for command-line tools and server-side programs.
Is Dart easy to learn for beginners?
Yes. Dart has a clean, consistent syntax, helpful error messages and a type system that catches mistakes while you type. If you have never programmed before, start at chapter 1 and follow the lessons in order. If you know JavaScript, Java, Kotlin or C#, most of Dart will feel familiar.
How long does it take to learn Dart?
With about an hour a day, most beginners finish the core chapters in four to six weeks. Developers who already know another language often cover the basics in a few days and then spend their time on null safety, async programming and the Dart 3 features.
Do I need to learn Dart before Flutter?
You do not need to master Dart first, but you do need the basics: variables, functions, classes, null safety, collections and async. Every Flutter widget is a Dart class, so time spent on Dart pays back quickly.
Do I need to install anything to follow this Dart tutorial?
No. Examples with a Run button open in DartPad, the official online editor, so you can start in the browser. The second lesson shows how to install the Dart SDK on Windows, macOS and Linux when you are ready.
Which version of Dart does this tutorial cover?
The tutorial covers Dart 3, including sound null safety, records, patterns, switch expressions, sealed classes, class modifiers and extension types.
Is this Dart tutorial free?
Yes. Every lesson is free to read, with no sign-up and no paywall.