Implement switch expressions in examples/ and animation/ (#139882)

Thanks so much for approving the previous PR (#139048) a couple weeks ago!

This one is the same, except it's covering files in `examples/` and `packages/flutter/lib/src/animation/`.

(solving issue #136139)
This commit is contained in:
Nate
2023-12-11 15:56:04 -07:00
committed by GitHub
parent 6a61e878a6
commit 140f5eef4c
6 changed files with 33 additions and 50 deletions

View File

@@ -48,20 +48,14 @@ class _MyHomePageState extends State<MyHomePage> {
}
static Widget get _buttonText {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return const Text('Continue in Android view');
case TargetPlatform.iOS:
return const Text('Continue in iOS view');
case TargetPlatform.windows:
return const Text('Continue in Windows view');
case TargetPlatform.macOS:
return const Text('Continue in macOS view');
case TargetPlatform.linux:
return const Text('Continue in Linux view');
case TargetPlatform.fuchsia:
throw UnimplementedError('Platform not yet implemented');
}
return switch (defaultTargetPlatform) {
TargetPlatform.android => const Text('Continue in Android view'),
TargetPlatform.iOS => const Text('Continue in iOS view'),
TargetPlatform.windows => const Text('Continue in Windows view'),
TargetPlatform.macOS => const Text('Continue in macOS view'),
TargetPlatform.linux => const Text('Continue in Linux view'),
TargetPlatform.fuchsia => throw UnimplementedError('Platform not yet implemented'),
};
}
Future<void> _launchPlatformCount() async {