OLD | NEW |
1 | 1 |
2 library pets; | 2 library pets; |
3 | 3 |
4 import 'dart:math'; | 4 import 'dart:math'; |
5 import 'dart:isolate'; | 5 import 'dart:isolate'; |
6 | 6 |
7 final num MAX_CATS = 10; | 7 final num MAX_CATS = 10; |
8 | 8 |
9 final SPARKY = const Cat("Sparky"); | 9 final SPARKY = const Cat("Sparky"); |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 class Dog extends FloppyEars implements Animal { | 82 class Dog extends FloppyEars implements Animal { |
83 static final String BEST_DOG_NAME = "Chips"; | 83 static final String BEST_DOG_NAME = "Chips"; |
84 | 84 |
85 String name; | 85 String name; |
86 | 86 |
87 bool collar; | 87 bool collar; |
88 | 88 |
89 int fleaCount; | 89 int fleaCount; |
90 | 90 |
91 Date bornOn; | 91 DateTime bornOn; |
92 | 92 |
93 Dog(this.name) { | 93 Dog(this.name) { |
94 var rand = new Random(); | 94 var rand = new Random(); |
95 fleaCount = rand.nextInt(10); | 95 fleaCount = rand.nextInt(10); |
96 bornOn = new Date.now(); | 96 bornOn = new DateTime.now(); |
97 } | 97 } |
98 | 98 |
99 Dog.withFleas(this.name, this.fleaCount) { | 99 Dog.withFleas(this.name, this.fleaCount) { |
100 bornOn = new Date.now(); | 100 bornOn = new DateTime.now(); |
101 } | 101 } |
102 | 102 |
103 bool livesWith(Animal other) => true; | 103 bool livesWith(Animal other) => true; |
104 | 104 |
105 void performAction() { | 105 void performAction() { |
106 String name = "iHideAnInstanceVariable"; | 106 String name = "iHideAnInstanceVariable"; |
107 | 107 |
108 print("bark"); | 108 print("bark"); |
109 | 109 |
110 var closure = () { | 110 var closure = () { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 // display sets (_HashSetImpl) | 191 // display sets (_HashSetImpl) |
192 var set = new Set(); | 192 var set = new Set(); |
193 set.add(1); | 193 set.add(1); |
194 set.add(2); | 194 set.add(2); |
195 set.add(2); | 195 set.add(2); |
196 set.add("what"); | 196 set.add("what"); |
197 | 197 |
198 print("types"); | 198 print("types"); |
199 } | 199 } |
OLD | NEW |