Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
"Learn Dart Before you Flutter" Youtube video solution
class Order {
var _id;
var _reference;
var date;
var code;
List<String> bookings;
Order(this._id, this._reference, {});
Order.withDiscount(this._id, this._reference, [this.code]) {
date =;
getInfo() {
print('''Your order information:
Id: $_id
Reference: $_reference
Date: $date
${code != null ? 'Code: $code' : ''}
void main() {
Order order1 = Order(1, 'ref1', date:;
Order order2 = Order.withDiscount(2, 'ref2')
..code = 'DARTROCKS!'
..bookings = ['booking1', 'booking2', 'booking3']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment