-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as not planned
Closed as not planned
Copy link
Labels
area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).Dart language related items (some items might be better tracked at github.com/dart-lang/language).core-mtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
I have an abstract class with the following constructor. It has 5 subclasses, each of which should have that exact same constructor. For reasons that I hope are obvious, I don't really want to have to write out that whole signature six times, plus 5 occurrences of referencing the superclass constructor listing all the arguments...
abstract class PointerEvent extends Event {
PointerEvent({ bool bubbles,
this.pointer,
this.kind,
this.x, this.y,
this.dx: 0.0, this.dy: 0.0,
this.buttons: 0,
this.down: false,
this.primary: false,
this.obscured: false,
this.pressure, this.minPressure, this.maxPressure,
this.distance, this.minDistance, this.maxDistance,
this.radiusMajor, this.radiusMinor, this.minRadius, this.maxRadius,
this.orientation, this.tilt
}): super(bubbles: bubbles);
// ...lots of final fields...
}
Lasse suggests allowing a shorthand syntax for declaring constructors that just redirect to the superclass:
abstract class PointerDownEvent extends PointerEvent {
PointerDownEvent = super;
}
micimize, tp, benthillerkus, janstol, janosroden and 27 morethibaultzanini, tapizquent and royKarseboom
Metadata
Metadata
Assignees
Labels
area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).Dart language related items (some items might be better tracked at github.com/dart-lang/language).core-mtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug