-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[image_picker] Deprecate platform interface methods #4520
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
[image_picker] Deprecate platform interface methods #4520
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
test-exempt: roll dependency |
| /// in this call. You can then call [getLostData] when your app relaunches to retrieve the lost data. | ||
| /// | ||
| /// If no images were picked, the return value is null. | ||
| @Deprecated('Use getImageFromSource instead.') |
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.
getImageFromSource uses getImage in this file:
Future<XFile?> getImageFromSource({
required ImageSource source,
ImagePickerOptions options = const ImagePickerOptions(),
}) {
return getImage(
source: source,
maxHeight: options.maxHeight,
maxWidth: options.maxWidth,
imageQuality: options.imageQuality,
preferredCameraDevice: options.preferredCameraDevice,
);
}
Should we flip the default implementation so the deprecated method calls the recommended one internally?
(At least in the platform implementations, so we don't extend deprecated methods?)
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.
getImageFromSourceusesgetImagein this file:
That's the default, not very good implementation, which platform implementations should override with a real one. See the paragraph starting "Note:" in https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-platform-interface-method-parameters
Should we flip the default implementation so the deprecated method calls the recommended one internally?
That would suddenly make all old implementations throw when used with newer versions of the app-facing package.
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.
The delegation of this method will feel backwards, because the implementing the new method in terms of the old method will discard the information from the new parameters. This is correct though, because the goal is to allow the app-facing package to call the new method regardless of whether implementation packages have implemented it.
Yep, exactly.
I'll flip the web implementation so the deprecated methods are based off of the new ones, so we can eventually remove the deprecated methods later!
flutter/packages@209db21...674179f 2023-07-19 [email protected] [image_picker] Deprecate platform interface methods (flutter/packages#4520) 2023-07-19 [email protected] [go_router] Adds a parentNavigatorKey parameter to ShellRouteData. (flutter/packages#4409) 2023-07-19 [email protected] [ci] Shard Windows Dart unit tests (flutter/packages#4519) 2023-07-19 [email protected] Roll Flutter from 6f09064 to d07e8ae (60 revisions) (flutter/packages#4522) 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 [email protected],[email protected] 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
flutter/packages@209db21...674179f 2023-07-19 [email protected] [image_picker] Deprecate platform interface methods (flutter/packages#4520) 2023-07-19 [email protected] [go_router] Adds a parentNavigatorKey parameter to ShellRouteData. (flutter/packages#4409) 2023-07-19 [email protected] [ci] Shard Windows Dart unit tests (flutter/packages#4519) 2023-07-19 [email protected] Roll Flutter from 6f09064 to d07e8ae (60 revisions) (flutter/packages#4522) 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 [email protected],[email protected] 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
Deprecates all of the platform interface methods that have been replaced with newer variants.
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).