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
{{ message }}
Repository navigation
Flutter gutter icons to not show for widgets inside conditional expressions #3196
newer to flutter ans VS, in my mac it can show flutter icons when write code, but it can not show in left ...
I searched a lot of information but didn’t find the answer
@PhoenixLeeSin are you able to trim your file down to something small you can share that still shows the problem? Perhaps with the same code I can reproduce it.
@bwilkerson this fails because I'm using the Flutter Outline data to locate icons, and for code with conditionals the then/else expressions are flat. This code:
Although I don't know if it's the correct/best fix. The conditional is not shown in the tree, so it looks a bit like a flat list even when some pair of the child nodes could be exclusive. Perhaps an additional node could be inserted, although it would add more to the tree (if/else in collections do not currently do that, they're just flattened, so this does match them).
I remember asking the question about if and for elements in the flutter outline when we were first implementing support for them, and I seem to remember that we decided to use a flat representation because we didn't have a good answer for the question of what to do when one branch would be represented in the outline and the other wouldn't.
I think that the solution in the referenced CL lgtm.
changed the title [-]Flutter gutter icons to not show for widgets inside conditional statements[/-][+]Flutter gutter icons to not show for widgets inside conditional expressions[/+]on Mar 24, 2021
This is fixed by dart-lang/sdk@387e9d9. The fix ships in the Dart SDK (not the VS Code extension), so will show up only once you're on a newer SDK that includes that change.
Activity
DanTup commentedon Mar 11, 2021
I've not been able to repro this, the same icon shows up here:
If you paste the following simple code into your file somewhere, does it show there?
Does it not show up in any files or just some specific ones?
PhoenixLeeSin commentedon Mar 12, 2021
@DanTup
in my project it not show up in any files but it show correctly code is const a = const Icon(Icons.keyboard_arrow_up);
DanTup commentedon Mar 15, 2021
@PhoenixLeeSin are you able to trim your file down to something small you can share that still shows the problem? Perhaps with the same code I can reproduce it.
PhoenixLeeSin commentedon Mar 16, 2021
@DanTup oh.....when i init a new flutter project, icons shows in left!!!!

i do not konw why....
DanTup commentedon Mar 16, 2021
@PhoenixLeeSin can you try copying exactly the same code (ideally the whole file) into the small test project, and see if the same occurs there?
PhoenixLeeSin commentedon Mar 17, 2021
@DanTup thank u reply, when i copy the whole file it occurs error..
It’s a small mistake, but it does make me uncomfortable sometimes
whole file :
DanTup commentedon Mar 17, 2021
@PhoenixLeeSin thanks! I was able to trim this down and it looks like it might be caused by the ternary operator:
I'll see if I can find a way to handle this. Thanks!
PhoenixLeeSin commentedon Mar 18, 2021
Thanks u Reply~
DanTup commentedon Mar 23, 2021
@bwilkerson this fails because I'm using the Flutter Outline data to locate icons, and for code with conditionals the then/else expressions are flat. This code:
Produces an outline like:
I had a look at handling this, and have a possible fix here (which supports conditionals both in
childexpressions and in widget lists):https://dart-review.googlesource.com/c/sdk/+/192688/
Although I don't know if it's the correct/best fix. The conditional is not shown in the tree, so it looks a bit like a flat list even when some pair of the child nodes could be exclusive. Perhaps an additional node could be inserted, although it would add more to the tree (if/else in collections do not currently do that, they're just flattened, so this does match them).
WDYT?
bwilkerson commentedon Mar 23, 2021
I remember asking the question about
ifandforelements in the flutter outline when we were first implementing support for them, and I seem to remember that we decided to use a flat representation because we didn't have a good answer for the question of what to do when one branch would be represented in the outline and the other wouldn't.I think that the solution in the referenced CL lgtm.
[analyzer] Include ConditionalExpressions in Flutter Outlines
[-]icons not show [/-][+]Flutter gutter icons to not show for widgets inside conditional statements[/+][-]Flutter gutter icons to not show for widgets inside conditional statements[/-][+]Flutter gutter icons to not show for widgets inside conditional expressions[/+]DanTup commentedon Mar 24, 2021
This is fixed by dart-lang/sdk@387e9d9. The fix ships in the Dart SDK (not the VS Code extension), so will show up only once you're on a newer SDK that includes that change.