blob: d06992b6e3364393421ab9f7e3e13b64ad64cd61 [file] [log] [blame]
40 columns |
>>> Declare variable with `var`.
for ( var file in files ) { body ; }
<<<
for (var file in files) {
body;
}
>>> Declare with type annotation.
for ( List < int > ints in intLists ) { body ; }
<<<
for (List<int> ints in intLists) {
body;
}
>>> Declare variable with `final` and type.
for (final Foo foo in foos) { body; }
<<<
for (final Foo foo in foos) {
body;
}
>>> Declare variable with just `final`.
for (final foo in foos) {
body;
}
<<<
for (final foo in foos) {
body;
}
>>> Use existing variable.
for ( x in things ) { body; }
<<<
for (x in things) {
body;
}
>>> Await for with declared variable.
foo() async {
await for ( var x in y ) { body ; }
}
<<<
foo() async {
await for (var x in y) {
body;
}
}
>>> Await for with existing variable.
foo() async {
await for ( x in y ) { body ; }
}
<<<
foo() async {
await for (x in y) {
body;
}
}
>>> Split between variable type and name.
for (VeryLongClassName reallyLongIdentifier in iteratableExpression) { body; }
<<<
for (VeryLongClassName
reallyLongIdentifier
in iteratableExpression) {
body;
}
>>> Split before `in`.
for (var identifier in iteratableExpression) { body; }
<<<
for (var identifier
in iteratableExpression) {
body;
}
>>> Split inside initializer.
for (var identifier in someVeryLong + iterableExpression) { body; }
<<<
for (var identifier
in someVeryLong +
iterableExpression) {
body;
}
>>> Prefer block-like splitting after `in`.
for (var identifier in [element, element, element]) { body; }
<<<
for (var identifier in [
element,
element,
element,
]) {
body;
}
>>> Unsplit non-block body.
for (i in sequence) something(i);
<<<
for (i in sequence) something(i);
>>> Split non-block body.
for (i in sequence) somethingMuchLonger(i);
<<<
for (i in sequence)
somethingMuchLonger(i);
>>> Split between type and variable name.
for (SomeReallyLongTypeName andALongVariable in list) {;}
<<<
for (SomeReallyLongTypeName
andALongVariable
in list) {
;
}
>>> Expression split in pattern.
for (var (longIdentifier && anotherLongOne) in obj) {;}
<<<
for (var (longIdentifier &&
anotherLongOne)
in obj) {
;
}
>>> Block split in pattern.
for (var [longIdentifier, anotherLongOne] in obj) {;}
<<<
for (var [
longIdentifier,
anotherLongOne,
]
in obj) {
;
}
>>> With pattern, split in value.
for (var (first, second, third) in longValueExpression + anotherOperand +
aThirdOperand) {;}
<<<
for (var (first, second, third)
in longValueExpression +
anotherOperand +
aThirdOperand) {
;
}
>>> Split in pattern and value.
for (var (longIdentifier && anotherAlsoLongOne) in longValueExpression +
anotherOperand + aThirdOperand) {;}
<<<
for (var (longIdentifier &&
anotherAlsoLongOne)
in longValueExpression +
anotherOperand +
aThirdOperand) {
;
}
>>> If pattern doesn't block split, then split in right splits at `in` too.
for (var [i] in veryLongIterator +
longExpression) {;}
<<<
for (var [i]
in veryLongIterator +
longExpression) {
;
}