Arrow syntax for getters (#156483)

This egotistical PR aims to draw attention to a [style guideline](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use--for-getters-and-callbacks-that-just-return-literals-or-switch-expressions) that I changed:

> #### Use `=>` for getters and callbacks that just return literals or switch expressions

<br>

There was an opportunity for valuable discussion in #154753 about how this structure affects readability, but I shut it down pretty quick since there was a lot of other stuff going on there.

Interested to hear thoughts from @Piinks and others.
This commit is contained in:
Nate Wilson
2024-10-17 13:25:14 -06:00
committed by GitHub
parent fdbd855fdc
commit 6b1bc456f4
36 changed files with 239 additions and 345 deletions

View File

@@ -67,18 +67,16 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
final Set<TestScenario> values = Set<TestScenario>.from(TestScenario.values);
late TestScenario currentValue;
bool get resample {
return switch (currentValue) {
TestScenario.resampleOn90Hz || TestScenario.resampleOn59Hz => true,
TestScenario.resampleOff90Hz || TestScenario.resampleOff59Hz => false,
};
}
double get frequency {
return switch (currentValue) {
TestScenario.resampleOn90Hz || TestScenario.resampleOff90Hz => 90.0,
TestScenario.resampleOn59Hz || TestScenario.resampleOff59Hz => 59.0,
};
}
bool get resample => switch (currentValue) {
TestScenario.resampleOn90Hz || TestScenario.resampleOn59Hz => true,
TestScenario.resampleOff90Hz || TestScenario.resampleOff59Hz => false,
};
double get frequency => switch (currentValue) {
TestScenario.resampleOn90Hz || TestScenario.resampleOff90Hz => 90.0,
TestScenario.resampleOn59Hz || TestScenario.resampleOff59Hz => 59.0,
};
Map<String, dynamic>? result;