Last active
April 26, 2017 23:56
-
-
Save Sfshaza/b276b686774b1ce56cd38f7c668922c6 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 { | |
Point origin; | |
int width; | |
int height; | |
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(new Rectangle(origin: const Point(10, 20), width: 100, height: 200)); | |
print(new Rectangle(origin: const Point(10, 10))); | |
print(new Rectangle(width: 200)); | |
print(new Rectangle()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment