| 40 columns | |
| >>> Named parameter. |
| f( { optional = null } ) {} |
| <<< |
| f({optional = null}) {} |
| >>> Named parameter with old separator. |
| ### This syntax is no longer supported by new versions of Dart, but we want to |
| ### support formatting older versions if possible. |
| f( { optional : 1 + 2 } ) {} |
| <<< |
| f({optional: 1 + 2}) {} |
| >>> Optional positional parameter. |
| f( [ optional = 1 + 2 ] ) {} |
| <<< |
| f([optional = 1 + 2]) {} |
| >>> Split on positional default. |
| doStuff([parameter = veryLongDefaultValueThatSplits, another = |
| veryLongDefaultValue, third = alsoQuiteLongDefaultValue]) {} |
| <<< |
| doStuff([ |
| parameter = |
| veryLongDefaultValueThatSplits, |
| another = veryLongDefaultValue, |
| third = alsoQuiteLongDefaultValue, |
| ]) {} |
| >>> Split on named default. |
| doStuff({parameter = veryLongDefaultValueThatSplits, another = |
| veryLongDefaultValue, third = alsoAQuiteLongDefaultValue}) {} |
| <<< |
| doStuff({ |
| parameter = |
| veryLongDefaultValueThatSplits, |
| another = veryLongDefaultValue, |
| third = alsoAQuiteLongDefaultValue, |
| }) {} |
| >>> Prefer block-like splitting for collection default values. |
| function([param = [element, element, element, element]]) { body; } |
| <<< |
| function([ |
| param = [ |
| element, |
| element, |
| element, |
| element, |
| ], |
| ]) { |
| body; |
| } |
| >>> Function typed parameter with default value. |
| f([callback() = constantFunction]) {} |
| <<< |
| f([callback() = constantFunction]) {} |
| >>> Split in function typed parameter parameter list with default value. |
| f([callback(SomeLongType longParameter, AnotherType anotherParameter) = constantFunction]) {} |
| <<< |
| ### TODO(rnystrom): The output isn't ideal here, but code like this is very |
| ### rare. See the comment in PieceFactory.writeFunctionType(). |
| f([ |
| callback( |
| SomeLongType longParameter, |
| AnotherType anotherParameter, |
| ) = |
| constantFunction, |
| ]) {} |
| >>> Split in function typed parameter default value. |
| f([callback(SomeType parameter) = const CallableClass(someLongConstantArgument, anotherConstantArgument)]) {} |
| <<< |
| f([ |
| callback(SomeType parameter) = |
| const CallableClass( |
| someLongConstantArgument, |
| anotherConstantArgument, |
| ), |
| ]) {} |