This file contains hidden or 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
| class Color { | |
| final double red; | |
| final double green; | |
| final double blue; | |
| const Color(this.red, this.green, this.blue); | |
| static double blendedChannel(double leftChannel, double rightChannel, double progress) => | |
| leftChannel * (1.0 - progress) + rightChannel * progress; |
This file contains hidden or 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
| class City { | |
| String name; | |
| String countryName; | |
| int population; | |
| bool isCapital; | |
| City(this.name, this.countryName, this.population, {this.isCapital = false}); | |
| @override |
This file contains hidden or 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
| enum SheepSoundLength { | |
| short, | |
| medium, | |
| long | |
| } | |
| const LettersCountBySheepSoundLength = const { | |
| SheepSoundLength.short : 1, | |
| SheepSoundLength.medium : 3, |
This file contains hidden or 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
| enum SentencePurpose { declarative, imperative, interrogative, exclamatory } | |
| const endPunctuationByPurpose = const { | |
| SentencePurpose.declarative: ".", | |
| SentencePurpose.imperative: ".", | |
| SentencePurpose.interrogative: "?", | |
| SentencePurpose.exclamatory: "!" | |
| }; | |
| const underWaterSoundsByCharacter = const { |
This file contains hidden or 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
| import "dart:math"; | |
| class Port { | |
| static final randomGenerator = new Random(); | |
| static const cargoNames = const [ | |
| "guano", | |
| "fuzzy dice", | |
| "weasles", | |
| "bubble wrap", | |
| "shoelaces", |
This file contains hidden or 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
| void main() { | |
| var familiarLanguages = ["C", "C++", "Objective-C", "C#", "Java", "JavaScript"]; | |
| print("Welcome to Dart!"); | |
| for (var language in familiarLanguages) { | |
| print("If you know $language, you already know most of Dart."); | |
| } |