Skip to content

Instantly share code, notes, and snippets.

@pzentenoe
Created February 22, 2019 16:47
Show Gist options
  • Save pzentenoe/960dfa19909e9340b5020a9edc289f0d to your computer and use it in GitHub Desktop.
Save pzentenoe/960dfa19909e9340b5020a9edc289f0d to your computer and use it in GitHub Desktop.
Ejemplo de parametros opcionales en dart
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());
} // Included main() to suppress uncaught exception.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment