Enable no_default_cases lint (#91530)
This commit is contained in:
@@ -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}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user