Skip to content

Commit

Permalink
Delete unreachable default clauses. (#561)
Browse files Browse the repository at this point in the history
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
dart-lang/sdk#54575.

This PR deletes unreachable `default` clauses from `photo_view` now, to
avoid a spurious warning when the analyzer change lands.
  • Loading branch information
stereotype441 authored Sep 4, 2024
1 parent 47d347d commit a13ca2f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/photo_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,6 @@ PhotoViewScaleState defaultScaleStateCycle(PhotoViewScaleState actual) {
case PhotoViewScaleState.zoomedIn:
case PhotoViewScaleState.zoomedOut:
return PhotoViewScaleState.initial;
default:
return PhotoViewScaleState.initial;
}
}

Expand Down
3 changes: 0 additions & 3 deletions lib/src/utils/photo_view_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ double getScaleForScaleState(
scaleBoundaries);
case PhotoViewScaleState.originalSize:
return _clampSize(1.0, scaleBoundaries);
// Will never be reached
default:
return 0;
}
}

Expand Down

0 comments on commit a13ca2f

Please sign in to comment.