Skip to content

Instantly share code, notes, and snippets.

@Sfshaza
Last active April 26, 2017 23:56
Show Gist options
  • Save Sfshaza/b276b686774b1ce56cd38f7c668922c6 to your computer and use it in GitHub Desktop.
Save Sfshaza/b276b686774b1ce56cd38f7c668922c6 to your computer and use it in GitHub Desktop.
Java-to-Dart codelab: Final Rectangle example
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