Enable no_default_cases lint (#91530)

This commit is contained in:
Ian Hickson
2021-10-11 10:23:04 -07:00
committed by GitHub
parent 66ff778602
commit 7b01346c5c
52 changed files with 337 additions and 90 deletions

View File

@@ -47,7 +47,7 @@ class TestStepResult {
return snapshot.data!;
}
return snapshot.error! as TestStepResult;
default:
case ConnectionState.active:
throw 'Unsupported state ${snapshot.connectionState}';
}
}

View File

@@ -257,8 +257,6 @@ class CalcExpression {
case ExpressionState.NumberWithPoint:
case ExpressionState.Result:
return appendOperation(Operation.Subtraction);
default:
return null;
}
}

View File

@@ -608,7 +608,7 @@ class Tab2ConversationBubble extends StatelessWidget {
backgroundColor = CupertinoTheme.of(context).primaryColor;
foregroundColor = CupertinoColors.white;
break;
default:
case null:
break;
}

View File

@@ -219,7 +219,7 @@ class _ListDemoState extends State<ListDemo> {
case _MaterialListType.threeLine:
itemTypeText = 'Three-line';
break;
default:
case null:
break;
}

View File

@@ -156,7 +156,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
),
);
break;
default:
case null:
listTile = Container(
key: Key(item.value),
);

View File

@@ -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()
),

View File

@@ -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)!);

View File

@@ -116,7 +116,7 @@ class CutCornersBorder extends OutlineInputBorder {
canvas.drawPath(path, paint);
break;
}
default:
case null:
break;
}
}

View File

@@ -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();
},

View File

@@ -28,7 +28,7 @@ class TestStepResult {
final Object? result = snapshot.error;
return result! as TestStepResult;
}
default:
case ConnectionState.active:
throw 'Unsupported state ${snapshot.connectionState}';
}
}