Never miss a beat

Join my newsletter.

Tag: learn_dart

Dart Mixins Guide

Published: 4/24/2021

There are a lot of forms of inheritance. Abstract classes, interfaces, some languages have "traits", and in Dart, we have Mixins (and abstract classes and implicit interfaces, too). Mixins are a way to reuse class code in multiple class hierarchies. How do you declare a Mixin in Dart? Mixins require using 2 different keywords to fully make use of them in Dart. First, we use the mixin keyword to declare a new mixin. Our mixin can then be applied to other classes using the with keyword…