Skip to content

Instantly share code, notes, and snippets.

@dpossas
Created July 21, 2020 11:55
Show Gist options
  • Save dpossas/5766b215b587b909460dc548b413659b to your computer and use it in GitHub Desktop.
Save dpossas/5766b215b587b909460dc548b413659b to your computer and use it in GitHub Desktop.
Dart - The basics in pratice
main () {
final shopping = new ShoppingCart ();
// the use of the reserved word new is optional as of DART 2.0
// and we will not use it in the next lines
final pen = Product("Caneta", true, 4.75);
shopping.addItem(pen);
final pencil = Product("Pencil", false, 1.25);
shopping.addItem(pencil);
print ("Total purchase: $ {shopping.total ()}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment