Mobile development

Stage 1 · Lesson 4 of 10

Classes, constructors, mixins and enums

Dart fundamentals

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

  • GuideFree
    Dart Language Tour

    Google · Beginner

    The official tour: read it in order and rerun every example in DartPad

Practise

  • Dart, TypeScript, Kotlin and Swift tracks with small exercises and free mentor feedback

Keep handy

  • Its Dart tutorial pages work as a quick lookup while you do the tour

Also worth your time

Mark this stage as not done?