OLD | NEW |
(Empty) | |
| 1 40 columns | |
| 2 >>> arithmetic operators |
| 3 var a=1+2/(3*-b~/4); |
| 4 <<< |
| 5 var a = 1 + 2 / (3 * -b ~/ 4); |
| 6 >>> conditional operator |
| 7 var c=!condition==a>b; |
| 8 <<< |
| 9 var c = !condition == a > b; |
| 10 >>> |
| 11 var d=condition?b:obj.foo(a, b); |
| 12 <<< |
| 13 var d = condition ? b : obj.foo(a, b); |
| 14 >>> as |
| 15 identifier as TypeName; |
| 16 <<< |
| 17 identifier as TypeName; |
| 18 >>> is |
| 19 identifier is TypeName; |
| 20 <<< |
| 21 identifier is TypeName; |
| 22 >>> is! |
| 23 var d=obj is!SomeType; |
| 24 <<< |
| 25 var d = obj is! SomeType; |
| 26 >>> generic list literal |
| 27 < int >[1,2,(3+4)]; |
| 28 <<< |
| 29 <int>[1, 2, (3 + 4)]; |
| 30 >>> |
| 31 x && |
| 32 y; |
| 33 <<< |
| 34 x && y; |
| 35 >>> empty map literal (dartbug.com/16382) |
| 36 var m = { }; |
| 37 <<< |
| 38 var m = {}; |
| 39 >>> |
| 40 var m = {}; |
| 41 <<< |
| 42 var m = {}; |
| 43 >>> generic map literal |
| 44 < int,int >{ }; |
| 45 <<< |
| 46 <int, int>{}; |
| 47 >>> unqualified symbol |
| 48 var x = #foo; |
| 49 <<< |
| 50 var x = #foo; |
| 51 >>> qualified symbol |
| 52 var y=#foo.bar.baz; |
| 53 <<< |
| 54 var y = #foo.bar.baz; |
| 55 >>> long string literal |
| 56 throw new FormatException("This is a long exception message."); |
| 57 <<< |
| 58 throw new FormatException( |
| 59 "This is a long exception message."); |
| 60 >>> |
| 61 assert(false); |
| 62 <<< |
| 63 assert(false); |
| 64 >>> DON'T indent lines that are continued with a function expression. |
| 65 new Future(new Duration(1), () { |
| 66 print('I am a callback'); |
| 67 }); |
| 68 <<< |
| 69 new Future(new Duration(1), () { |
| 70 print('I am a callback'); |
| 71 }); |
| 72 >>> DO use a space after : in named arguments. |
| 73 new ListBox(showScrollbars :true); |
| 74 <<< |
| 75 new ListBox(showScrollbars: true); |
| 76 >>> multiple prefix operators |
| 77 - ~ ! foo; |
| 78 <<< |
| 79 -~!foo; |
| 80 >>> sequential "-" operators are not joined |
| 81 - - - -foo; |
| 82 <<< |
| 83 - - - -foo; |
| 84 >>> a "-" operator before a negative integer is not joined |
| 85 - -1; |
| 86 <<< |
| 87 - -1; |
| 88 >>> a "-" operator before a negative floating point number is not joined |
| 89 - -1.2; |
| 90 <<< |
| 91 - -1.2; |
| 92 >>> multiline string inside nested blocks |
| 93 main() { |
| 94 inner() { |
| 95 function(""" |
| 96 string"""); |
| 97 } |
| 98 } |
| 99 <<< |
| 100 main() { |
| 101 inner() { |
| 102 function(""" |
| 103 string"""); |
| 104 } |
| 105 } |
| 106 >>> null coalescing operator |
| 107 argument?? argument; |
| 108 <<< |
| 109 argument ?? argument; |
| 110 >>> ?. operator |
| 111 receiver ?. method() ?. getter; |
| 112 <<< |
| 113 receiver?.method()?.getter; |
| 114 >>> null coalescing self assignment |
| 115 variableName??=argument; |
| 116 <<< |
| 117 variableName ??= argument; |
OLD | NEW |