| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 try { | 147 try { |
| 148 flow(); | 148 flow(); |
| 149 } catch (e) { | 149 } catch (e) { |
| 150 print(e); | 150 print(e); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 >>> DON'T use a space after (, [, and {, or before ), ], and }. | 153 >>> DON'T use a space after (, [, and {, or before ), ], and }. |
| 154 spaces() { | 154 spaces() { |
| 155 var numbers = <int> [ 1, 2,( 3+4 ) ]; | 155 var numbers = <int> [ 1, 2,( 3+4 ) ]; |
| 156 var mapLiteral = <int, int> {}; |
| 156 } | 157 } |
| 157 <<< | 158 <<< |
| 158 spaces() { | 159 spaces() { |
| 159 var numbers = <int>[1, 2, (3 + 4)]; | 160 var numbers = <int>[1, 2, (3 + 4)]; |
| 161 var mapLiteral = <int, int>{}; |
| 160 } | 162 } |
| 161 >>> DO use a space before { in function and method bodies. | 163 >>> DO use a space before { in function and method bodies. |
| 162 getEmptyFn(a){ | 164 getEmptyFn(a){ |
| 163 return (){}; | 165 return (){}; |
| 164 } | 166 } |
| 165 <<< | 167 <<< |
| 166 getEmptyFn(a) { | 168 getEmptyFn(a) { |
| 167 return () {}; | 169 return () {}; |
| 168 } | 170 } |
| 169 >>> DO format constructor initialization lists with each field on its own line. | 171 >>> DO format constructor initialization lists with each field on its own line. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 217 } |
| 216 } | 218 } |
| 217 >>> DO use four spaces for method cascades | 219 >>> DO use four spaces for method cascades |
| 218 var list = new List() | 220 var list = new List() |
| 219 ..addAll([1, 2, 3]) | 221 ..addAll([1, 2, 3]) |
| 220 ..addAll([4, 5, 6]); | 222 ..addAll([4, 5, 6]); |
| 221 <<< | 223 <<< |
| 222 var list = new List() | 224 var list = new List() |
| 223 ..addAll([1, 2, 3]) | 225 ..addAll([1, 2, 3]) |
| 224 ..addAll([4, 5, 6]); | 226 ..addAll([4, 5, 6]); |
| OLD | NEW |