Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8fc5c65

Browse files
[multiple] Avoid new unreachable_switch_default warning. (#54996)
The Dart analyzer will soon be changed so that if the `default` clause of a `switch` statement is determined to be unreachable by the exhaustiveness checker, a new warning of type `unreachable_switch_default` will be issued. This parallels the behavior of the existing `unreachable_switch_case` warning, which is issued whenever a `case` clause of a `switch` statement is determined to be unreachable. Before adding the new warning to the analyzer, code in the engine needs to first be updated to eliminate these unreachable `default` clauses, so that the warning won't cause builds to break. For more information, see dart-lang/sdk#54575.
1 parent 0fad460 commit 8fc5c65

File tree

6 files changed

+0
-11
lines changed

6 files changed

+0
-11
lines changed

lib/web_ui/lib/src/engine/canvaskit/color_filter.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,5 @@ CkColorFilter? createCkColorFilter(EngineColorFilter colorFilter) {
266266
return const CkLinearToSrgbGammaColorFilter();
267267
case ColorFilterType.srgbToLinearGamma:
268268
return const CkSrgbToLinearGammaColorFilter();
269-
default:
270-
throw StateError('Unknown mode $colorFilter.type for ColorFilter.');
271269
}
272270
}

lib/web_ui/lib/src/engine/canvaskit/embedded_views.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,6 @@ class Mutator {
844844
return matrix == typedOther.matrix;
845845
case MutatorType.opacity:
846846
return alpha == typedOther.alpha;
847-
default:
848-
return false;
849847
}
850848
}
851849

lib/web_ui/lib/src/engine/html/bitmap_canvas.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,6 @@ String? stringForStrokeCap(ui.StrokeCap? strokeCap) {
13371337
case ui.StrokeCap.round:
13381338
return 'round';
13391339
case ui.StrokeCap.square:
1340-
default:
13411340
return 'square';
13421341
}
13431342
}
@@ -1349,7 +1348,6 @@ String stringForStrokeJoin(ui.StrokeJoin strokeJoin) {
13491348
case ui.StrokeJoin.bevel:
13501349
return 'bevel';
13511350
case ui.StrokeJoin.miter:
1352-
default:
13531351
return 'miter';
13541352
}
13551353
}

lib/web_ui/lib/src/engine/html/shaders/shader.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,5 @@ EngineHtmlColorFilter? createHtmlColorFilter(EngineColorFilter? colorFilter) {
914914
throw UnimplementedError('ColorFilter.linearToSrgbGamma not implemented for HTML renderer');
915915
case ColorFilterType.srgbToLinearGamma:
916916
throw UnimplementedError('ColorFilter.srgbToLinearGamma not implemented for HTML renderer.');
917-
default:
918-
throw StateError('Unknown mode $colorFilter.type for ColorFilter.');
919917
}
920918
}

lib/web_ui/lib/src/engine/text/paragraph.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,6 @@ String? _decorationStyleToCssString(ui.TextDecorationStyle decorationStyle) {
11181118
return 'solid';
11191119
case ui.TextDecorationStyle.wavy:
11201120
return 'wavy';
1121-
default:
1122-
return null;
11231121
}
11241122
}
11251123

lib/web_ui/lib/src/engine/text_editing/text_capitalization.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class TextCapitalizationConfig {
7575
case TextCapitalization.sentences:
7676
autocapitalize = 'sentences';
7777
case TextCapitalization.none:
78-
default:
7978
autocapitalize = 'off';
8079
}
8180
if (domInstanceOfString(domElement, 'HTMLInputElement')) {

0 commit comments

Comments
 (0)