Last active
August 29, 2015 13:56
-
-
Save chris-ramon/9135351 to your computer and use it in GitHub Desktop.
dart notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Dartium => Build of Chromium that has Dart VMtree-shaking process where unused code is not included in the final output of the program, that said u can import all kind libraries and not caring about unuse code.eg dart2js supports tree-shaking for Dart and Js outputs | |
final variables can not change | |
static class level fields | |
string interpolation: '$_firstName $_secondName' | |
=> expr; shorthand for {return expr;} | |
*/ | |
PirateName.readyThePirates() | |
.then((_) { // _ means no parameters are ignored | |
//on success | |
inputField.disabled = false; //enable | |
genButton.disabled = false; //enable | |
setBadgeName(getBadgeNameFromStorage()); | |
}) | |
.catchError((arrr) { | |
print('Error initializing pirate names: $arrr'); | |
badgeNameElement.text = 'Arrr! No names.'; | |
}); | |
class Item { | |
int maxSize; | |
String name; | |
Item([this.name, this.maxSize = 100]); | |
} | |
class Message { | |
int _id; | |
String _text; | |
Message({int id, String text}) { | |
_id = id; | |
_text = text; | |
} | |
int get id => _id; | |
String get text => _text; | |
} | |
main() { | |
Item i = new Item('chris', 300); | |
print(i.name); | |
print(i.maxSize); | |
Message m = new Message(text: 'hi there', id: 123); | |
print(m.id); | |
print(m.text); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment