Mixins are a way of reusing a class’s code in multiple class hierarchies.
To use a mixin, use the with keyword followed by one or more mixin names. The following example shows two classes that use mixins:
class MyClass with MyMixin {
// ···
}
To implement a mixin, create a class that extends Object and declares no constructors.
Unless you want your mixin to be usable as a regular class, use the mixin keyword instead of class.
For example:
mixin MyMixin {
// ···
}