| OLD | NEW |
| 1 >>> DO use ; instead of {} for empty constructor bodies | 1 >>> DO use ; instead of {} for empty constructor bodies |
| 2 class Point { | 2 class Point { |
| 3 int x, y; | 3 int x, y; |
| 4 Point(this.x, this.y) {} | 4 Point(this.x, this.y) {} |
| 5 } | 5 } |
| 6 <<< | 6 <<< |
| 7 class Point { | 7 class Point { |
| 8 int x, y; | 8 int x, y; |
| 9 Point(this.x, this.y); | 9 Point(this.x, this.y); |
| 10 } | 10 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 thirdField = "last"; | 175 thirdField = "last"; |
| 176 } | 176 } |
| 177 <<< | 177 <<< |
| 178 class MyClass { | 178 class MyClass { |
| 179 var firstField, secondField, thirdField; | 179 var firstField, secondField, thirdField; |
| 180 MyClass() | 180 MyClass() |
| 181 : firstField = "some value", | 181 : firstField = "some value", |
| 182 secondField = "another", | 182 secondField = "another", |
| 183 thirdField = "last"; | 183 thirdField = "last"; |
| 184 } | 184 } |
| 185 >>> DO format constructor initialization lists with each field on its own line. |
| 186 class MyClass { |
| 187 MyClass(looooooooooooooonA, looooooooooooooonB) : super(looooooooooooooonA, lo
oooooooooooooonB); |
| 188 MyClass(looooooooooooooonA, looooooooooooooonB) : this(looooooooooooooonA, loo
ooooooooooooonB); |
| 189 } |
| 190 <<< |
| 191 class MyClass { |
| 192 MyClass(looooooooooooooonA, looooooooooooooonB) |
| 193 : super(looooooooooooooonA, looooooooooooooonB); |
| 194 MyClass(looooooooooooooonA, looooooooooooooonB) |
| 195 : this(looooooooooooooonA, looooooooooooooonB); |
| 196 } |
| 185 >>> DO use a space after : in named parameters and named arguments. | 197 >>> DO use a space after : in named parameters and named arguments. |
| 186 class ListBox { | 198 class ListBox { |
| 187 bool showScrollbars; | 199 bool showScrollbars; |
| 188 | 200 |
| 189 ListBox({this.showScrollbars: false}); | 201 ListBox({this.showScrollbars: false}); |
| 190 } | 202 } |
| 191 | 203 |
| 192 main() { | 204 main() { |
| 193 new ListBox(showScrollbars:true); | 205 new ListBox(showScrollbars:true); |
| 194 new ListBox(showScrollbars : true); | 206 new ListBox(showScrollbars : true); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 217 } | 229 } |
| 218 } | 230 } |
| 219 >>> DO use four spaces for method cascades | 231 >>> DO use four spaces for method cascades |
| 220 var list = new List() | 232 var list = new List() |
| 221 ..addAll([1, 2, 3]) | 233 ..addAll([1, 2, 3]) |
| 222 ..addAll([4, 5, 6]); | 234 ..addAll([4, 5, 6]); |
| 223 <<< | 235 <<< |
| 224 var list = new List() | 236 var list = new List() |
| 225 ..addAll([1, 2, 3]) | 237 ..addAll([1, 2, 3]) |
| 226 ..addAll([4, 5, 6]); | 238 ..addAll([4, 5, 6]); |
| OLD | NEW |