-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camera] Switch web package to new analysis options #4834
[camera] Switch web package to new analysis options #4834
Conversation
Switches from legacy analysis options to current analysis options, fixing all analysis issues it exposed. Part of flutter/flutter#76229
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So many missing types, omg. I think I only found one maybe-typo with a list of lists below (which probably doesn't matter too much) 🚀
packages/camera/camera_web/example/integration_test/camera_service_test.dart
Show resolved
Hide resolved
packages/camera/camera_web/example/integration_test/camera_service_test.dart
Show resolved
Hide resolved
packages/camera/camera_web/example/integration_test/camera_service_test.dart
Show resolved
Hide resolved
packages/camera/camera_web/example/integration_test/camera_service_test.dart
Show resolved
Hide resolved
packages/camera/camera_web/example/integration_test/camera_web_test.dart
Outdated
Show resolved
Hide resolved
(videoTrackCapabilities[_facingModeKey] as List<dynamic>?) | ||
?.cast<String>() ?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the explicit .cast() here? can't this be done at the same time as the as
above?
videoTrackCapabilities[_facingModeKey] as List<String>?) ?? <String>[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. This is an example of what I was talking about in the other comment. dynamic
is castable to String
, but List<dynamic>
isn't castable to List<String>
.
See https://dartpad.dev/?id=bb6c33398890a6b30c5c5a3db5bdf27f for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhh I understand, yikes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This however works in the same Gist:
List<Object?> bad = allStrings as List<Object?>; // "as" not even needed!
I think dynamic
can be handled as Object?
to mitigate what lrhn is commenting here.
(I'm sorry I can't find any better resource than that comment, I'd swear I had read about "Using Object?
instead of dynamic
" somewhere :S)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I'll need to research more. I've definitely been applying the "always use Object?
instead of dynamic
" guidance in all other cases, but I've been so wary of things like JSON and method channels after screwing it up several times that I just retreated to "assume that since it's coming in as dynamic
only dynamic
is safe", which it sounds like swung too far.
* google/master: (340 commits) [camera]remove "selfRef" for SavePhotoDelegate and ensure thread safety (flutter#4780) Roll Flutter from 919d205 to adafd66 (5 revisions) (flutter#4876) [google_sign_in] Update platform interface analysis options (flutter#4872) Roll Flutter from b623279 to 919d205 (2 revisions) (flutter#4871) Roll Flutter from 14a2b13 to b623279 (5 revisions) (flutter#4870) [image_picker] Update platform interface analysis options (flutter#4837) [ci] Re-enable stable webview Android tests (flutter#4867) Roll Flutter from 286c975 to 14a2b13 (1 revision) (flutter#4865) [local_auth] support localizedFallbackTitle in IOSAuthMessages (flutter#3806) [image_picker] Update app-facing and web analysis options (flutter#4838) Roll Flutter from 8386344 to 286c975 (4 revisions) (flutter#4864) Roll Flutter from e9f83cf to 8386344 (6 revisions) (flutter#4862) [camera] Switch web package to new analysis options (flutter#4834) [flutter_plugin_tool] Fix iOS/macOS naming (flutter#4861) [webview_flutter] Fix debuggingEnabled on Android (flutter#4859) Roll Flutter from ca2a751 to e9f83cf (10 revisions) (flutter#4857) fix license (flutter#4858) [video_player] add allowBackgroundPlayback option platform interface changes (flutter#4807) [video_player] Updated Pigeon version (flutter#4726) Roll Flutter from 381cb28 to ca2a751 (5 revisions) (flutter#4850) ... # Conflicts: # packages/camera/camera/CHANGELOG.md # packages/camera/camera/android/build.gradle # packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java # packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/MethodCallHandlerImpl.java # packages/camera/camera/ios/Classes/CameraPlugin.m # packages/camera/camera/ios/camera.podspec # packages/camera/camera/lib/camera.dart # packages/camera/camera/lib/src/camera_controller.dart # packages/camera/camera/pubspec.yaml
Switches from legacy analysis options to current analysis options,
fixing all analysis issues it exposed.
Part of flutter/flutter#76229
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).