Enable no_default_cases lint (#91530)
This commit is contained in:
@@ -64,7 +64,7 @@ class _FilteredChildAnimationPageState extends State<FilteredChildAnimationPage>
|
||||
case FilterType.opacity: return 'Fading Child Animation';
|
||||
case FilterType.rotateTransform: return 'Transformed Child Animation';
|
||||
case FilterType.rotateFilter: return 'Matrix Filtered Child Animation';
|
||||
default: return 'Static Child';
|
||||
case null: return 'Static Child';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,10 @@ void _setTestMode(_TestMode? mode) {
|
||||
case _TestMode.useCanvasTextLayout:
|
||||
useCanvasText = true;
|
||||
break;
|
||||
default:
|
||||
case _TestMode.useCanvasKit:
|
||||
case null:
|
||||
// Keep as null.
|
||||
break;
|
||||
}
|
||||
js_util.callMethod(
|
||||
html.window,
|
||||
|
||||
@@ -74,8 +74,6 @@ abstract class DeviceDiscovery {
|
||||
case DeviceOperatingSystem.fake:
|
||||
print('Looking for fake devices! You should not see this in release builds.');
|
||||
return FakeDeviceDiscovery();
|
||||
default:
|
||||
throw DeviceException('Unsupported device operating system: $deviceOperatingSystem');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class TestStepResult {
|
||||
return snapshot.data!;
|
||||
}
|
||||
return snapshot.error! as TestStepResult;
|
||||
default:
|
||||
case ConnectionState.active:
|
||||
throw 'Unsupported state ${snapshot.connectionState}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,8 +257,6 @@ class CalcExpression {
|
||||
case ExpressionState.NumberWithPoint:
|
||||
case ExpressionState.Result:
|
||||
return appendOperation(Operation.Subtraction);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ class Tab2ConversationBubble extends StatelessWidget {
|
||||
backgroundColor = CupertinoTheme.of(context).primaryColor;
|
||||
foregroundColor = CupertinoColors.white;
|
||||
break;
|
||||
default:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ class _ListDemoState extends State<ListDemo> {
|
||||
case _MaterialListType.threeLine:
|
||||
itemTypeText = 'Three-line';
|
||||
break;
|
||||
default:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
|
||||
),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
case null:
|
||||
listTile = Container(
|
||||
key: Key(item.value),
|
||||
);
|
||||
|
||||
@@ -169,8 +169,6 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
|
||||
return Tab(icon: Icon(page.icon));
|
||||
case TabsDemoStyle.textOnly:
|
||||
return Tab(text: page.text);
|
||||
default:
|
||||
return Tab();
|
||||
}
|
||||
}).toList()
|
||||
),
|
||||
|
||||
@@ -90,7 +90,7 @@ class _CustomRangeThumbShape extends RangeSliderThumbShape {
|
||||
case Thumb.end:
|
||||
thumbPath = _leftTriangle(size, center);
|
||||
break;
|
||||
default:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -102,11 +102,11 @@ class _CustomRangeThumbShape extends RangeSliderThumbShape {
|
||||
case Thumb.end:
|
||||
thumbPath = _rightTriangle(size, center);
|
||||
break;
|
||||
default:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
canvas.drawPath(thumbPath, Paint()..color = colorTween.evaluate(enableAnimation)!);
|
||||
|
||||
@@ -116,7 +116,7 @@ class CutCornersBorder extends OutlineInputBorder {
|
||||
canvas.drawPath(path, paint);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case null:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,8 +408,8 @@ class _PlatformItem extends StatelessWidget {
|
||||
final GalleryOptions? options;
|
||||
final ValueChanged<GalleryOptions>? onOptionsChanged;
|
||||
|
||||
String? _platformLabel(TargetPlatform? platform) {
|
||||
switch(platform) {
|
||||
String _platformLabel(TargetPlatform platform) {
|
||||
switch (platform) {
|
||||
case TargetPlatform.android:
|
||||
return 'Mountain View';
|
||||
case TargetPlatform.fuchsia:
|
||||
@@ -422,9 +422,6 @@ class _PlatformItem extends StatelessWidget {
|
||||
return 'Material Desktop (macOS)';
|
||||
case TargetPlatform.windows:
|
||||
return 'Material Desktop (Windows)';
|
||||
default:
|
||||
assert(false);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,7 +436,7 @@ class _PlatformItem extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
const Text('Platform mechanics'),
|
||||
Text(
|
||||
_platformLabel(options!.platform)!,
|
||||
_platformLabel(options!.platform!),
|
||||
style: Theme.of(context).primaryTextTheme.bodyText2,
|
||||
),
|
||||
],
|
||||
@@ -452,7 +449,7 @@ class _PlatformItem extends StatelessWidget {
|
||||
return TargetPlatform.values.map((TargetPlatform platform) {
|
||||
return PopupMenuItem<TargetPlatform>(
|
||||
value: platform,
|
||||
child: Text(_platformLabel(platform)!),
|
||||
child: Text(_platformLabel(platform)),
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
|
||||
@@ -28,7 +28,7 @@ class TestStepResult {
|
||||
final Object? result = snapshot.error;
|
||||
return result! as TestStepResult;
|
||||
}
|
||||
default:
|
||||
case ConnectionState.active:
|
||||
throw 'Unsupported state ${snapshot.connectionState}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,16 +291,20 @@ class CardCollectionState extends State<CardCollection> {
|
||||
case DismissDirection.startToEnd:
|
||||
backgroundMessage = 'Swipe right to dismiss';
|
||||
break;
|
||||
default:
|
||||
case DismissDirection.vertical:
|
||||
case DismissDirection.up:
|
||||
case DismissDirection.down:
|
||||
case DismissDirection.none:
|
||||
backgroundMessage = 'Unsupported dismissDirection';
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO(abarth): This icon is wrong in RTL.
|
||||
// This icon is wrong in RTL.
|
||||
Widget leftArrowIcon = const Icon(Icons.arrow_back, size: 36.0);
|
||||
if (_dismissDirection == DismissDirection.startToEnd)
|
||||
leftArrowIcon = Opacity(opacity: 0.1, child: leftArrowIcon);
|
||||
|
||||
// TODO(abarth): This icon is wrong in RTL.
|
||||
// This icon is wrong in RTL.
|
||||
Widget rightArrowIcon = const Icon(Icons.arrow_forward, size: 36.0);
|
||||
if (_dismissDirection == DismissDirection.endToStart)
|
||||
rightArrowIcon = Opacity(opacity: 0.1, child: rightArrowIcon);
|
||||
|
||||
Reference in New Issue
Block a user