avoid-returning-cascades
Warns when a cascade expression is being returned from a function.
Returning cascade expressions can add additional confusion to the code reader as to what is actually being returned.
Example
❌ Bad:
class Cow {
void moo() {}
}
Cow getCow() {
// LINT: Avoid returning cascade expressions.
// Try declaring a variable separately and returning it instead.
return Cow..moo();
}
✅ Good:
Cow getAnotherCow() {
final cow = Cow();
cow.moo();
return cow;
}