Skip to content

Instantly share code, notes, and snippets.

@eungikim
Created October 25, 2019 17:10
Show Gist options
  • Save eungikim/393484d725f9aa2025ea256b1362e4f2 to your computer and use it in GitHub Desktop.
Save eungikim/393484d725f9aa2025ea256b1362e4f2 to your computer and use it in GitHub Desktop.
Java-to-Dart codelab: Rectangle example
import 'dart:math';
class Rectangle {
int width;
int height;
Point origin;
Rectangle({this.origin = const Point(0,0), this.width = 0, this.height = 0});
@override
toString() => 'Origin (${origin.x}, ${origin.y}), width: $width, height: $height';
}
main() {
print(Rectangle(origin: const Point(10, 20), width: 100, height: 200));
print(Rectangle(origin: const Point(10,10)));
print(Rectangle(width: 200));
print(Rectangle());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment