OLD | NEW |
(Empty) | |
| 1 40 columns | |
| 2 >>> Single initializers can be on one line |
| 3 class Foo extends Bar { |
| 4 final int b; |
| 5 Foo(int a, this.b) : super(a); |
| 6 } |
| 7 <<< |
| 8 class Foo extends Bar { |
| 9 final int b; |
| 10 Foo(int a, this.b) : super(a); |
| 11 } |
| 12 >>> (or not) |
| 13 class Foo extends Bar { |
| 14 final int b; |
| 15 Foo(int a, this.b): super(aLongIdentifier); |
| 16 } |
| 17 <<< |
| 18 class Foo extends Bar { |
| 19 final int b; |
| 20 Foo(int a, this.b) |
| 21 : super(aLongIdentifier); |
| 22 } |
| 23 >>> Multiple initializers are one per line |
| 24 class Foo extends Bar { |
| 25 final int b; |
| 26 Foo(int a, int b) : super(a), this.b = b == null ? 0 : b; |
| 27 } |
| 28 <<< |
| 29 class Foo extends Bar { |
| 30 final int b; |
| 31 Foo(int a, int b) |
| 32 : super(a), |
| 33 this.b = b == null ? 0 : b; |
| 34 } |
| 35 >>> try to keep constructor call together |
| 36 var longIdentifier = new Thing( |
| 37 argument, argument); |
| 38 <<< |
| 39 var longIdentifier = |
| 40 new Thing(argument, argument); |
| 41 >>> splits before ":" if the parameter list does not fit on one line |
| 42 class Foo { |
| 43 Foo(int longArg1, int longArg2, int longArg3) : this._(longArg1); |
| 44 } |
| 45 <<< |
| 46 class Foo { |
| 47 Foo(int longArg1, int longArg2, |
| 48 int longArg3) |
| 49 : this._(longArg1); |
| 50 } |
| 51 >>> indent parameters more if body is a wrapped => |
| 52 class Foo { |
| 53 Foo(firstArgument, secondArgument, third) => "very long body that must wrap"; |
| 54 } |
| 55 <<< |
| 56 class Foo { |
| 57 Foo(firstArgument, secondArgument, |
| 58 third) => |
| 59 "very long body that must wrap"; |
| 60 } |
| 61 >>> wrap initializers past the ":" |
| 62 class Foo { |
| 63 Foo(parameter) |
| 64 : initializer = function(argument, argument), |
| 65 initializer2 = function(argument, argument); |
| 66 } |
| 67 <<< |
| 68 class Foo { |
| 69 Foo(parameter) |
| 70 : initializer = function( |
| 71 argument, argument), |
| 72 initializer2 = function( |
| 73 argument, argument); |
| 74 } |
| 75 >>> split at "=" in initializer |
| 76 class Foo { |
| 77 Foo() : initializer =function(argument, arg); |
| 78 } |
| 79 <<< |
| 80 class Foo { |
| 81 Foo() |
| 82 : initializer = |
| 83 function(argument, arg); |
| 84 } |
OLD | NEW |