-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)Contributions welcome to help resolve this (the resolution is expected to be clear from the issue)devexp-quick-fixIssues with analysis server (quick) fixesIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Sometimes I have code like:
if(count==1){
return foo();
} else if (count==2){
return bar();
} else{
throw ArgumentError("$count isn't a valid count");
}
And I think the code would be more concise as:
switch (count){
case 1: return foo();
case 2: return bar();
default: throw ArgumentError("$count isn't a valid count");
}
It would be great if I would have a quick assist option to change both the first into the second and the second into the first (as sometimes I decide I want ifs after already having written switch statements. Of course when the if tree has a form that can't simply be converted into a switch statements no quick assist option would be shown.
FMorschel
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)Contributions welcome to help resolve this (the resolution is expected to be clear from the issue)devexp-quick-fixIssues with analysis server (quick) fixesIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug