From 4d916db231d825496ff4871581d923d587ed0235 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 27 Aug 2024 23:54:14 +0000 Subject: [PATCH] Delete unreachable `default` clauses. 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. For details see https://github.com/dart-lang/sdk/issues/54575. This PR deletes unreachable `default` clauses from `photo_view` now, to avoid a spurious warning when the analyzer change lands. --- lib/photo_view.dart | 2 -- lib/src/utils/photo_view_utils.dart | 3 --- 2 files changed, 5 deletions(-) diff --git a/lib/photo_view.dart b/lib/photo_view.dart index f731c8a6..269f8cf2 100644 --- a/lib/photo_view.dart +++ b/lib/photo_view.dart @@ -585,8 +585,6 @@ PhotoViewScaleState defaultScaleStateCycle(PhotoViewScaleState actual) { case PhotoViewScaleState.zoomedIn: case PhotoViewScaleState.zoomedOut: return PhotoViewScaleState.initial; - default: - return PhotoViewScaleState.initial; } } diff --git a/lib/src/utils/photo_view_utils.dart b/lib/src/utils/photo_view_utils.dart index 0d2645e9..73706080 100644 --- a/lib/src/utils/photo_view_utils.dart +++ b/lib/src/utils/photo_view_utils.dart @@ -21,9 +21,6 @@ double getScaleForScaleState( scaleBoundaries); case PhotoViewScaleState.originalSize: return _clampSize(1.0, scaleBoundaries); - // Will never be reached - default: - return 0; } }