most elegant way to initialize members with default values

You can initialize variables in a constructor using this prefix, eg:

class PointA { 
  double _x;
  double get x => _x;
  double _y;
  double get y => _y;

  PointA({double this._x=0.0, double this._y=0.0});
}

class PointB { 
  final double x;
  final double y;

  Point({double this.x=0.0, double this.y=0.0});
}

void main() {
  new PointA(_y:2.0); 
  new PointA(_x:3.0); 
  new PointA(_x:2.0, _y:3.0); 

  new PointB(y:2.0); 
  new PointB(x:3.0); 
  new PointB(x:2.0, y:3.0); 
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)