Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

dart class fields final

class Point {
  final num x;
  final num y;
  final num distanceFromOrigin;

  Point._(this.x, this.y, this.distanceFromOrigin);

  factory Point(num x, num y) {
    num distance = distanceFromOrigin = sqrt(pow(x, 2) + pow(y, 2));
    return new Point._(x, y, distance);
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dart #class #fields #final
ADD COMMENT
Topic
Name
7+3 =