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:
@@ -85,21 +85,10 @@ class _DraggableScrollableSheetExampleState extends State<DraggableScrollableShe
|
||||
);
|
||||
}
|
||||
|
||||
bool get _isOnDesktopAndWeb {
|
||||
if (kIsWeb) {
|
||||
return true;
|
||||
}
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.macOS:
|
||||
case TargetPlatform.linux:
|
||||
case TargetPlatform.windows:
|
||||
return true;
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.iOS:
|
||||
case TargetPlatform.fuchsia:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool get _isOnDesktopAndWeb => kIsWeb || switch (defaultTargetPlatform) {
|
||||
TargetPlatform.macOS || TargetPlatform.linux || TargetPlatform.windows => true,
|
||||
TargetPlatform.android || TargetPlatform.iOS || TargetPlatform.fuchsia => false,
|
||||
};
|
||||
}
|
||||
|
||||
/// A draggable widget that accepts vertical drag gestures
|
||||
|
||||
Reference in New Issue
Block a user