-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[various] More analysis_options alignment #6949
Changes from 15 commits
2243d4e
2283d72
2cee850
8ae0527
0ecf2e2
097e88e
247c4b8
77a3bb7
d7796f2
78e2a49
266365b
274ed0f
b6ff982
95fc6e4
9c91164
c0ba721
a4b0468
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 0.10.2+2 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| ## 0.10.2+1 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,6 +145,7 @@ class AndroidCamera extends CameraPlatform { | |
| // ignore: body_might_complete_normally_catch_error | ||
| (Object error, StackTrace stackTrace) { | ||
| if (error is! PlatformException) { | ||
| // ignore: only_throw_errors | ||
| throw error; | ||
| } | ||
| completer.completeError( | ||
|
|
@@ -520,9 +521,14 @@ class AndroidCamera extends CameraPlatform { | |
| return 'always'; | ||
| case FlashMode.torch: | ||
| return 'torch'; | ||
| default: | ||
| throw ArgumentError('Unknown FlashMode value'); | ||
| } | ||
| // The enum comes from a different package, which could get a new value at | ||
| // any time, so provide a fallback that ensures this won't break when used | ||
| // with a version that contains new values. This is deliberately outside | ||
| // the switch rather than a `default` so that the linter will flag the | ||
| // switch as needing an update. | ||
| // ignore: dead_code | ||
| return 'off'; | ||
| } | ||
|
|
||
| /// Returns the resolution preset as a String. | ||
|
|
@@ -540,9 +546,14 @@ class AndroidCamera extends CameraPlatform { | |
| return 'medium'; | ||
| case ResolutionPreset.low: | ||
| return 'low'; | ||
| default: | ||
| throw ArgumentError('Unknown ResolutionPreset value'); | ||
| } | ||
| // The enum comes from a different package, which could get a new value at | ||
| // any time, so provide a fallback that ensures this won't break when used | ||
| // with a version that contains new values. This is deliberately outside | ||
| // the switch rather than a `default` so that the linter will flag the | ||
| // switch as needing an update. | ||
| // ignore: dead_code | ||
| return 'max'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we should just keep the old behavior of throwing? It seems like in most of these cases you can keep the same behavior by removing the exception outside of the default branch which would keep the same logic.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could keep the same logic, but I changed it because throwing seems very extreme to me when there's a reasonable fallback. When these switches were first written, everything was one package and this case meant that we'd forgotten to implement something, so it was a bug. Now it means that a client is using an implementation version that doesn't support that option yet, so a fallback seems better to me. |
||
| } | ||
|
|
||
| /// Converts messages received from the native platform into device events. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 0.9.10+2 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| ## 0.9.10+1 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,9 +34,11 @@ IconData getCameraLensIcon(CameraLensDirection direction) { | |
| case CameraLensDirection.front: | ||
| return Icons.camera_front; | ||
| case CameraLensDirection.external: | ||
| return Icons.camera; | ||
| // This enum is from a different package, so a new value could be added at | ||
| // any time. The example should keep working if that happens. | ||
| // ignore: no_default_cases | ||
|
||
| default: | ||
| throw ArgumentError('Unknown lens direction'); | ||
| return Icons.camera; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,6 +145,7 @@ class AVFoundationCamera extends CameraPlatform { | |
| // ignore: body_might_complete_normally_catch_error | ||
| (Object error, StackTrace stackTrace) { | ||
| if (error is! PlatformException) { | ||
| // ignore: only_throw_errors | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should these be addressed instead of ignored?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In practice this is only a violation if |
||
| throw error; | ||
| } | ||
| completer.completeError( | ||
|
|
@@ -526,9 +527,14 @@ class AVFoundationCamera extends CameraPlatform { | |
| return 'always'; | ||
| case FlashMode.torch: | ||
| return 'torch'; | ||
| default: | ||
| throw ArgumentError('Unknown FlashMode value'); | ||
| } | ||
| // The enum comes from a different package, which could get a new value at | ||
| // any time, so provide a fallback that ensures this won't break when used | ||
| // with a version that contains new values. This is deliberately outside | ||
| // the switch rather than a `default` so that the linter will flag the | ||
| // switch as needing an update. | ||
| // ignore: dead_code | ||
| return 'off'; | ||
| } | ||
|
|
||
| /// Returns the resolution preset as a String. | ||
|
|
@@ -546,9 +552,14 @@ class AVFoundationCamera extends CameraPlatform { | |
| return 'medium'; | ||
| case ResolutionPreset.low: | ||
| return 'low'; | ||
| default: | ||
| throw ArgumentError('Unknown ResolutionPreset value'); | ||
| } | ||
| // The enum comes from a different package, which could get a new value at | ||
| // any time, so provide a fallback that ensures this won't break when used | ||
| // with a version that contains new values. This is deliberately outside | ||
| // the switch rather than a `default` so that the linter will flag the | ||
| // switch as needing an update. | ||
| // ignore: dead_code | ||
| return 'max'; | ||
| } | ||
|
|
||
| /// Converts messages received from the native platform into device events. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 2.3.4 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| ## 2.3.3 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 2.4.3 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| ## 2.4.2 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 0.4.0+5 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
| ## 0.4.0+4 | ||
|
|
||
| * Updates code for stricter lint checks. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.