0PricingLogin
Dart Academy · Lesson

Mixins With the with Keyword

Add capabilities without single inheritance.

Beyond Single Parents

A Dart class can extend only one parent, but you often want abilities from several sources. A mixin lets you blend in extra behavior cleanly. 🧩

Declaring a Mixin

You define one with the mixin keyword. It looks like a class but is meant to be mixed into others, not instantiated on its own.

mixin Swimmer {
  void swim() => print('Swimming');
}

All lessons in this course

  1. extends and Method Overriding
  2. Calling super and Constructor Chaining
  3. Mixins With the with Keyword
  4. on Constraints and Mixin Order
← Back to Dart Academy