Skip to content

[image_picker] Add desktop support - platform interface #4161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

stuartmorgan-g
Copy link
Contributor

Platform interface portion of #3882

Adds CameraDelegatingImagePickerPlatform and ImagePickerCameraDelegate, and supportsImageSource

Part of flutter/flutter#102115
Part of flutter/flutter#102320
Part of flutter/flutter#85100

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@stuartmorgan-g stuartmorgan-g changed the title Image picker macos linux platform interface [image_picker] Add desktop support - platform interface Jun 8, 2023
Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question.

ImagePickerOptions options = const ImagePickerOptions(),
}) async {
if (source == ImageSource.camera) {
final ImagePickerCameraDelegate? delegate = cameraDelegate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Dart won't promote nullable fields (because in general it can't guarantee that you aren't running this code in the context of a subclass that overrode the field with a getter that does something crazy like return null every other time you call it), you have two options for cases like this:

  • Make a local variable, null check it to promote it, and then use it as non-nullable.
  • Null-check the field, then use ! every time you access it.

I strongly prefer the former since it relies on the compiler to ensure that things are still right any time someone changes the logic, while the latter relies on humans to ensure it.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 8, 2023
@auto-submit auto-submit bot merged commit afe2f05 into flutter:main Jun 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 9, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 9, 2023
flutter/packages@e13b8c4...afe2f05

2023-06-08 stuartmorgan@google.com [image_picker] Add desktop support - platform interface (flutter/packages#4161)
2023-06-08 nils@reichardt.io [go_router] Update link to example for query and path parameters (flutter/packages#3994)
2023-06-08 49699333+dependabot[bot]@users.noreply.github.com [in_app_pur]: Bump org.jetbrains.kotlin:kotlin-bom from 1.8.0 to 1.8.21 in /packages/in_app_purchase/in_app_purchase_android/android (flutter/packages#3839)
2023-06-08 49699333+dependabot[bot]@users.noreply.github.com [image_picker]: Bump androidx.activity:activity from 1.7.0 to 1.7.1 in /packages/image_picker/image_picker_android/android (flutter/packages#3768)
2023-06-08 stuartmorgan@google.com [webview_flutter] Explicitly disable ATS in example apps (flutter/packages#4166)
2023-06-08 engine-flutter-autoroll@skia.org Roll Flutter from 8a5c22e to 6e254a3 (12 revisions) (flutter/packages#4165)
2023-06-08 banasco@gmail.com Fix stale ignore: prefer_const_constructors from flutter/packages (flutter/packages#4154)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: image_picker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants