You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
final value = Value((b) => b
..anInt = 3
..aString = 'four');
Tall style:
final value = Value(
(b) =>
b
..anInt = 3
..aString = 'four',
);
Any ideas please? :)
I'd be open to pushing for a new special case syntax for "lambda that immediately does something to its only argument and never references it again" if that's what it takes ;)
The text was updated successfully, but these errors were encountered:
This is essentially the same issue as #1466. (=> and = are formatted using the same code, and cascades and method chains are mostly formatted using the same code.)
I agree, it doesn't look great. I haven't been able to come up with a fix that doesn't do the wrong thing in some cases. Here, if the cascade target expression was longer than just b, like b.someVeryLong.propertyChain that ended up splitting as well, then the formatter wouldn't do the right thing.
I have some ideas on how to fix this, #1466, and #1465, but I haven't been able to get them working with decent performance yet. It's a surprisingly hard problem.
One option might be to do a hacky fix where we don't split after the => if the target expression is suitably short/simple enough that we're confident that a split won't happen inside it. But I've tried to avoid those sorts of hacks in the new formatter as much as possible.
Short style:
Tall style:
Any ideas please? :)
I'd be open to pushing for a new special case syntax for "lambda that immediately does something to its only argument and never references it again" if that's what it takes ;)
The text was updated successfully, but these errors were encountered: