Can somebody explain this dart syntax? Is this documented somewhere?
abstract class FixedLengthListBase<E> =
ListBase<E> with FixedLengthListMixin<E>;
This is the syntax for declaring a named mixin application. It is introduced in the "Mixins in Dart" article.
They are defined by a special form of class declaration that gives them a name and declares them equal to an application of a mixin to a superclass, given via a with clause.
This is (almost) the same as writing
abstract class FixedLengthListBase<E> extends
ListBase<E> with FixedLengthListMixin<E>{}
The technical difference is that in this case FixedLengthListBase
is not a mixin application itself, but an abstract subclass of the implicit, unnamed mixin application ListBase<E> with FixedLengthListMixin<E>
This is a form of mixin application class
declaration.
classDefinition:
metadata abstract? class mixinApplicationClass
mixinApplicationClass:
identifier typeParameters? '=' mixinApplication ';'
The mixin application may be used to extend a class;
alternately, a class may be defined as a mixin application as described in this section.
mixinApplicationClass:
identifier typeParameters? '=' mixinApplication ';'
abstract class FixedLengthListBase<E> =
ListBase<E> with FixedLengthListMixin<E>;
https://www.dartlang.org/docs/spec/latest/dart-language-specification.html#h.trk07h8vrppk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With