Dart Tutorial: Learn Dart and Flutter from Beginner to Advanced
Learn Dart programming the easy way, then build real apps with Flutter. 107 short Dart lessons and a complete Flutter course, with simple examples you can run and edit in the browser and an exercise after every lesson.
Covers Dart 3 and current Flutter with Material 3. Free, no sign-up, works on any device.
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.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(child: Text('Hello, Flutter!')),
),
);
}
}One codebase. Runs on Android, iOS, web, Windows, macOS and Linux.
Popular Dart and Flutter topics
- Dart and Flutter roadmapA clear, free roadmap to learn Dart and Flutter step by step: what to study each week, …
- Dart online compilerFree Dart online compiler and Flutter playground. Write, edit and run Dart and Flutter …
- Dart syntaxLearn Dart syntax fast: program structure, semicolons, variables, types, strings, if else, …
- 30 Dart programming examples30 easy Dart programming examples for beginners with code and output: hello world, even …
- Dart list methodsAll the Dart list methods you need, with runnable examples: add, insert, remove, contains, …
- Dart string methodsEvery common Dart string method with a short, runnable example: trim, toUpperCase, …
- Dart null safetyLearn sound null safety in Dart: what null is, nullable types with ?, type promotion, and …
- Dart async awaitLearn how async and await work in Dart: write asynchronous code that reads like normal …
- Dart classes and objects (OOP)Learn object-oriented basics in Dart: define a class, create objects, and use fields, …
- Dart interview questionsForty common Dart interview questions with clear answers, covering basics, null safety, …
- Dart vs JavaScriptDart vs JavaScript compared side by side: types, null safety, variables, strings, classes, …
- Dart cheat sheetA one-page Dart cheat sheet: variables, strings, collections, control flow, functions, …
The Dart course
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
Dart Next Steps
Take your Dart skills further: build practice projects, prepare for interviews, keep a cheat sheet handy, then move on to Flutter.
The Flutter course
From installing the SDK to publishing apps and games on Google Play and the App Store, with every state management approach explained. The Flutter course has its own home on flutter.dart-tutorial.dev. Begin there once the Dart basics feel comfortable.
A Dart tutorial for beginners that goes all the way to advanced
This Dart tutorial teaches the Dart programming language from zero, then the Flutter framework for building apps for Android, iOS, the web and desktop from one codebase. You do not need any programming experience. Each lesson explains one idea in plain English, shows it in a short Dart example with its output, and ends with an exercise.
Not sure where to begin? Follow the free Dart and Flutter roadmap, or open the Dart online compiler and start typing.
What you will learn
In the Dart course (learn Dart programming):
- Dart basics. Dart syntax, variables, data types, strings and string methods, numbers and operators.
- Control flow. if else, loops, switch and the ternary operator.
- Functions and collections. Dart functions, parameters, closures, lists and list methods, sets and maps.
- Null safety. How Dart null safety stops null errors before your program runs.
- Dart OOP. Classes and objects, constructors, inheritance, interfaces, mixins, enums, generics and extensions.
- Modern Dart 3. Records, patterns, switch expressions, sealed classes and class modifiers.
- Asynchronous code. Future, async and await, streams, the event loop and isolates.
- Practical skills. Files, JSON, HTTP requests, dates, regular expressions, packages, testing and debugging.
In the Flutter tutorial (learn Flutter step by step, on flutter.dart-tutorial.dev):
- Widgets and layout. Stateless and stateful widgets, rows, columns, stacks, lists, grids and slivers.
- Material Design. App bars, navigation, dialogs, themes and dark mode.
- Input and navigation. Forms, validation, gestures, routes and go_router.
- State management. All 9 built-in tools and 20 packages: Riverpod, Bloc and Cubit, Provider, GetX, MobX, Signals, Redux and more.
- Data. HTTP, JSON models, loading states, local storage, SQLite and Firebase.
- Polish. Animations, responsive layouts for phones, tablets and desktop, accessibility and localization.
- Shipping. Testing, performance, architecture, and releasing on Android, iOS and the web.
- Games. 2D game development with the Flame engine and five complete games.
Practice: Dart examples, exercises and interview questions
Reading is not enough. These pages turn what you learned into skill:
- 30 Dart programming examples with code and output: factorial, Fibonacci, prime numbers, palindromes, classes, async and JSON.
- Dart exercises and practice projects for beginners to advanced.
- Dart interview questions and answers and Flutter interview questions.
- Dart cheat sheet and Flutter cheat sheet for quick syntax lookups.
- 8 complete Flutter examples you can run in the browser.
- Coming from the web? Read Dart vs JavaScript.
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 in either course. Mark lessons as done to keep track of where you are. Your progress is stored in your own browser and nowhere else.
Learners use Dart Tutorial from the USA, Canada, the UK and Europe, Australia, India, Nepal and everywhere else Flutter is used. The lessons are in simple English so they are easy to follow wherever you are.
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 of the Dart course and follow the lessons in order. If you know JavaScript, Java, Kotlin or C#, most of Dart will feel familiar.
Should I learn Dart or Flutter first?
Learn the Dart basics first: variables, functions, classes, null safety, collections and async. Every Flutter widget is a Dart class, so Flutter code is much easier to read once you know the language. You do not need to finish the whole Dart course before starting Flutter. The first seven chapters are enough to begin.
How long does it take to learn Dart and Flutter?
With about an hour a day, most beginners finish the core Dart chapters in four to six weeks, and can build simple Flutter apps a month or two after that. Developers who already know another language move faster.
Do I need to install anything to follow these tutorials?
Not to begin. Examples with a Run button open in DartPad, the official online editor, and that includes many Flutter examples. Each course has a lesson on installing the tools on Windows, macOS and Linux when you are ready.
Which versions do the tutorials cover?
The Dart course covers Dart 3, including sound null safety, records, patterns, sealed classes and class modifiers. The Flutter course uses current stable Flutter with Material 3.
Can I build Android and iOS apps with Flutter?
Yes. One Flutter codebase builds apps for Android, iOS, the web, Windows, macOS and Linux. The Flutter course ends with lessons on publishing to Google Play and the App Store.
Are the tutorials free?
Yes. Every lesson is free to read, with no sign-up and no paywall.
Can I run Dart code online without installing anything?
Yes. The Dart online compiler on this site runs Dart and Flutter code in your browser. Every example with a Run button opens in an editor where you can change the code and run it again.
What is the best way to learn Dart programming?
Follow the lessons in order, type and run every example, change it to see what happens, and finish the exercise at the end of each lesson. Then solve the 30 Dart programming examples and build one small project before moving on to Flutter.
Is Dart similar to JavaScript?
The syntax looks similar and both have async and await, so JavaScript developers learn Dart quickly. The main differences are that Dart is statically typed with sound null safety and compiles to fast native code for Flutter apps.