Just getting started on Dart. DartPad says my code is not null-safe, but I don't see a way to initialize a "Point" without assigning a value to x and y, so it should be null-safe, shouldn't it?
void main(){
Point p = new Point(1.0,2.0);
print(p.x);
}
class Point {
double x;
double y;
Point(double x, double y) {
this.x = x;
this.y = y;
}
}
Strangely enough, it works if I use what is outlined as "syntactic sugar". But doesn't that mean that the "common way" should also work?
void main(){
Point p = new Point(1.0,2.0);
print(p.x);
}
class Point {
double x;
double y;
Point(this.x, this.y) {}
}
What am I missing here?