Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample code for 'Learn Dart Before You Flutter' blog post on Medium (1)
class Order {
var _id;
var _reference;
var _date;
Order(id, reference, date) {
this._id = id;
this._reference = reference;
this._date = date;
}
getInfo() {
return 'Your order information:' +
'\n-------------------------------' +
'\n Id: $_id' +
'\n Reference: $_reference' +
'\n Date: $_date' +
'\n-------------------------------';
}
}
void main() {
var order1 = new Order(1, 'ref1', new DateTime.now());
print(order1.getInfo());
// Expected output
// Your order information:
// -------------------------------
// Id: 1
// Reference: ref1
// Date: 2018-04-21 19:06:20.507
// -------------------------------
}
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.