-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-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.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-new-language-featurelinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
We might consider a lint to encourage the use of switch-expressions.
BAD
Color shiftHue(Color color) {
switch (color) {
case Color.red:
return Color.orange;
case Color.blue:
return Color.purple;
case Color.green:
throw 'Green is bad';
case Color.yellow:
return Color.green;
}
}GOOD
Color shiftHue(Color color) {
return switch (color) {
Color.red => Color.orange,
Color.orange => Color.yellow,
Color.yellow => Color.green,
Color.green => throw 'Green is bad'
Color.blue => Color.purple,
Color.purple => Color.red
};
}munificent, JonasWanke, FMorschel, lishaduck and nilsreichardtjacob314 and FMorscheljacob314 and FMorschel
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-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.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-new-language-featurelinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug