switch expressions: finale (#148711)

### fixes #136139

<br>

<details open> <summary><b>getting sentimental in the PR description</b> (click to collapse)<br><br></summary>

The past 7 months have been quite the journey—I made some huge blunders and some huge accomplishments—a very fun time overall.

I really appreciate the people who took the time to perform code review for my refactoring shenanigans: **christopherfujino**, **andrewkolos**, **LongCatIsLooong**, **gspencergoog**, **loic-sharma**, **Piinks**, **bernaferrari**, **bartekpacia**, **bleroux**, **kevmoo**, **rakudrama**, **XilaiZhang**, **QuncCccccc**, **MominRaza**, and **victorsanni**.

And a huge shoutout to 2 individuals:
- @justinmc, for offering to sponsor me for commit access (words could not describe my excitement)
- @goderbauer, for being super duper proactive and consistent with code review

<br>

</details>

This pull request makes 13 "switch statements → switch expressions" PRs in total, reducing the LOC in this repo by **1,974**!

From now on, I'll make sure to request a test exemption for each refactoring PR 🙂
This commit is contained in:
Nate
2024-05-21 10:18:05 -06:00
committed by GitHub
parent 454dd7e29c
commit 870c5541c3
22 changed files with 214 additions and 466 deletions

View File

@@ -47,20 +47,14 @@ class StocksAppState extends State<StocksApp> {
}
ThemeData get theme {
switch (_configuration.stockMode) {
case StockMode.optimistic:
return ThemeData(
useMaterial3: false,
brightness: Brightness.light,
primarySwatch: Colors.purple,
);
case StockMode.pessimistic:
return ThemeData(
useMaterial3: false,
brightness: Brightness.dark,
primarySwatch: Colors.purple,
);
}
return ThemeData(
useMaterial3: false,
brightness: switch (_configuration.stockMode) {
StockMode.optimistic => Brightness.light,
StockMode.pessimistic => Brightness.dark,
},
primarySwatch: Colors.purple,
);
}
Route<dynamic>? _getRoute(RouteSettings settings) {