Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon graphicbeacon/main.dart
Last active Apr 21, 2018

What would you like to do?
Sample code for 'Learn Dart Before You Flutter' blog post on Medium (3)
class Order {
int _id;
String _reference;
DateTime _date;
String code; // public property
Order(this._id, this._reference, this._date);
Order.withDiscount(this._id, this._reference, {this.code}) {
_date = new;
// Shorthand methods FTW!!!
String getInfo() => 'Your order information:'
'\n Id: $_id'
'\n Reference: $_reference'
'\n Date: $_date'
void printInfo() => print(getInfo());
void main() {
Order order1 = new Order.withDiscount(1, 'ref1', code: 'LOVETHEWEEKEND');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.