Dart: mixins
Mixins in Dart The mixin keyword was introduced in dart 2.1 and it is analogous to abstract class in some ways and different from it in other way. Like abstract class , you can declare abstract methods in mixins and it cannot be instantiated. But unlike abstract , you can’t extend a mixin. You can either use the keyword mixin , abstract class or a normal class as a mixin. Let’s take a look at how we can solve the above problem with mixins. Always keep in mind that mixin is not multiple inheritance instead they are just a way to reuse our code from a class in multiple hierarchies without needing to extend them. Its like being able to use other people assets without being their children When mixing classes, the classes used as mixins are not parallel but instead on top of the class using it. This is the reason why methods do not conflict with one another, allowing us to use codes from multiple classes without having to deal with the vulnerabilities of multiple inheritance.