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
I recently stumbled upon this piece of code from a colleague of mine and had real problems at first to understand what is going on here:
One reason for sure was that I wasn't aware that we can use if and for not only inside Lists but also for Maps which is indeed a pretty cool feature :-) the bigger reason IMHO is that the way dartformat currently treats this makes it hard to spot where the key of the created/inserted pair is. To be honest I don't have a good idea of how to do this better. Maybe outdent the key?
Maybe @munificent has an idea of how to improve this.
The text was updated successfully, but these errors were encountered:
I agree!
I would like to insert a new line after a conditional or loop statement and indent the key. Here's an example of how it could look:
final current = {
if (true) 'a':1,
for (final i in [1, 2, 3]) 'b$i': i,
for (final nested in foo1)
for (final i in nested) 'c$i': i,
for (final nested in foo2) ...nested,
};
final proposed = {
if (true)
'a':1,
for (var i in [1, 2, 3])
'b$i': i,
for (final nested in foo1)
for (final i in nested)
'c$i': i,
for (final nested in foo2)
...nested,
};
I recently stumbled upon this piece of code from a colleague of mine and had real problems at first to understand what is going on here:
One reason for sure was that I wasn't aware that we can use
if
andfor
not only insideLists
but also forMaps
which is indeed a pretty cool feature :-) the bigger reason IMHO is that the way dartformat currently treats this makes it hard to spot where the key of the created/inserted pair is. To be honest I don't have a good idea of how to do this better. Maybe outdent the key?Maybe @munificent has an idea of how to improve this.
The text was updated successfully, but these errors were encountered: