Last active
June 11, 2018 18:20
-
-
Save kwalrath/bdc6a0c88482c4492912cc2849aa5121 to your computer and use it in GitHub Desktop.
Java-to-Dart codelab: Final Rectangle example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
String 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