blob: dfc15029130dd625da221143810aae28dc1a8e38 [file] [log] [blame]
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;
}