Named constructor
Named constructor
class Point {
num x, y;
Point(this.x, this.y);
// Named constructor
Point.origin() {
x = 0;
y = 0;
}
} Use a named constructor to implement multiple constructors for a class or to provide extra clarity.
Constructors are not inherited, which means that a superclass’s named constructor is not inherited by a subclass.
Semantic portal