Stage 1 · Lesson 4 of 10
Classes, constructors, mixins and enums
apps describe their data with small , which never change after creation. They have final fields, a const , and a copyWith method that returns a changed copy instead of editing the original. Learn the constructor shorthand (this.title), named constructors such as User.fromJson, and factory constructors.
Learn to override == and hashCode, so two users with the same id count as equal. A mixin adds reusable behaviour to a class with the with keyword. An lists a fixed set of options, and Dart enums can hold fields and methods too.
Common trapmutable model classes shared across screens, which change behind the UI's back and cause screens to show stale data.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with
- GuideFreeDart Language Tour
Google · Beginner
The official tour: read it in order and rerun every example in DartPad