In this lesson we talk about Dart, the language used to build Flutter apps.
Dart is an easy language to learn, and the easiest way to try it is with Dartpad, a free online editor that can run Dart and Flutter apps directly on your browser, without having to install anything on your machine.
You don’t need to read the entire documentation. Rather, come back to it as you improve your Dart coding style over time.
And if you’re looking for a fast-paced tutorial about Dart tips and tricks, I’ve got you covered:
In recent history, the most notable additions to the Dart language have been Null Safety, along with Pattern Matching and Records (which were added in Dart 3.0).
Null Safety is a big change that was introduced in 2021 with the Flutter 2.0 release. It is enabled by default every time you create a new Flutter project.
The documentation already covers everything you need to know about Null Safety:
Alternatively, you can check out the Null safety introduction video from the Flutter team or watch my in-depth tutorial:
Migrating old projects to Null Safety requires multiple steps. This article covers all the details:
Pattern Matching and Records
Records and patterns unlock a range of new features, such as multiple returns, destructuring, usable switches, sealed classes and more.
The official announcement contains all the details:
For an introduction to Dart 3, read this article on my site:
And if you want to make the most of these new features in your Flutter apps, don’t miss this excellent guide:
Upcoming Dart Features
Dart continues to improve, and big features such as static metaprogramming are planned in the future.
You can track the evolution of the Dart language on the Dart language funnel page on GitHub.
Other Dart resources
All the resources above are a good way to learn about the Dart language.
You can make the most of the links above if you’re already familiar with other programming languages.
But if you’re new to programming and Dart is your first language, I recommend taking my complete Dart course. This is a very comprehensive course and guides you all the way from “hello world” to the most advanced features of the language, with exercises and practical projects. Many programming concepts explained in the course will be invaluable once you tackle complex Flutter apps.
Note: my Dart course has not been updated for Dart 3.0 yet. As such, it does not cover pattern matching and records.
Bonus: Flutter Design Patterns
Some familiarity with the Dart language is already enough to start building simple Flutter apps.
But for bigger projects, you’ll want to become more experienced with OOP design patterns.
Fortunately, Mangirdas Kazlauskas has created an entire series of 23 articles covering Flutter Design Patterns. Here is the introduction:
This also comes with an open-source Flutter app that you can use to explore all the patterns.
If this seems like a lot of material, that’s because it is. Don’t worry, you don’t have to learn everything in one day, and neither did I when I started. Think of these as useful resources that you can come back to at any time.
Daily Challenge - Dart Cheatsheet Codelab
Test your knowledge of the Dart language by taking this interactive codelab: