ADocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
mixin class in Dart is a declaration that combines the capabilities of both a standard class and a mixin. Introduced in Dart 3.0 to enforce strict type modifiers, it allows a single structure to be instantiated directly, extended as a superclass, or mixed into other class hierarchies using the with keyword.
Syntax and Behavior
To define a mixin class, prepend theclass keyword with the mixin modifier.
Structural Constraints
To satisfy the compiler requirements of both a class and a mixin simultaneously, amixin class is subject to strict structural limitations:
- No Generative Constructors: A
mixin classcannot declare any custom generative constructors. It must rely exclusively on the implicit, unnamed, no-argument default constructor.
- No
extendsClause: Amixin classcannot extend any class other than the implicitObject. It must sit at the root of its own inheritance hierarchy.
- No
onClause: Unlike a puremixin, amixin classcannot use theonkeyword to restrict the types of classes it can be mixed into. It must be universally applicable to any class.
Modifier Comparison Matrix
Understandingmixin class requires distinguishing it from its base components under Dart 3.0 semantics:
| Modifier | Can be instantiated? | Can be extended (extends)? | Can be mixed in (with)? | Can use on clause? |
|---|---|---|---|---|
class | Yes | Yes | No | No |
mixin | No | No | Yes | Yes |
mixin class | Yes | Yes | Yes | No |
Master Dart with Deep Grasping Methodology!Learn More





