Nico Rodsevich
Nico Rodsevich

Reputation: 2575

How to group mixins in Dart?

I have a base package that defines A:

class A {}

Then a package that defines this:

mixin Aa on A {}
mixin Ab on A {}
abstract class First extends A with Aa, Ab{}

and another that defines this:

mixin Ax on A {}
mixin Ay on A {}
abstract class Last extends A with Ax, Ay {}

Then the package that gets that together with the problem

abstract class Clazz extends A with First, Last {} // <- Can't have those mixins bc they don't extend from Object

Question: Is there a way of grouping mixins or are we forced to implement them one by one?

Upvotes: 2

Views: 912

Answers (1)

lrn
lrn

Reputation: 71713

You are forced to implement the one-by-one.

There is currently no way to combine mixins into units that can be applied as one. Hopefully there will eventually be something like that. It's one the language team's radar (https://github.com/dart-lang/language/issues/540), but so is a lot of other enhancements.

Upvotes: 4

Related Questions