-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[file_selector] Convert XTypeGroup to const #6476
[file_selector] Convert XTypeGroup to const #6476
Conversation
f2abb61
to
2fbaeb2
Compare
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.
LGTM with nits. @ditman can you do the secondary review here?
.../file_selector/file_selector_platform_interface/lib/src/types/x_type_group/x_type_group.dart
Show resolved
Hide resolved
@@ -31,6 +30,13 @@ class XTypeGroup { | |||
/// The web wild cards for this group (ex: image/*, video/*) | |||
final List<String>? webWildCards; | |||
|
|||
final List<String>? _extensions; | |||
|
|||
/// The extensions for this group |
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.
Nit: This is missing the period at the end. (If you could fix the other comments' missing periods while you are touching this that would be great.)
.../file_selector/file_selector_platform_interface/lib/src/types/x_type_group/x_type_group.dart
Outdated
Show resolved
Hide resolved
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 looks good to me, however it breaks the current prefer_const_constructors
(and will possibly be a breaking change for users of the package (depending on their build config)).
Maybe a major version is too hardcore for this change (but maybe make this 2.2.0
?).
Also, we need to deal with the prefer_const_constructors
lint. We could disable it so we can land this, and fix usages of XTypeGroup across the repo, or fix Everything Everywhere All At Once in this PR.
Warning: You are using these overridden dependencies:
! file_selector_platform_interface 2.1.1 from path ../../file_selector/file_selector_platform_interface
Running command: "dart analyze --fatal-infos" in /tmp/cirrus-ci-build/packages/image_picker/image_picker_windows
Analyzing image_picker_windows...
info - lib/image_picker_windows.dart:122:9 - Prefer const with constant constructors. - prefer_const_constructors
info - lib/image_picker_windows.dart:146:9 - Prefer const with constant constructors. - prefer_const_constructors
info - lib/image_picker_windows.dart:162:9 - Prefer const with constant constructors. - prefer_const_constructors
3 issues found.
�[31mThe following packages had errors:�[0m
�[31m file_selector/file_selector�[0m
�[31m file_selector_ios�[0m
�[31m file_selector_linux�[0m
�[31m file_selector_macos�[0m
�[31m file_selector_web�[0m
�[31m file_selector_windows�[0m
�[31m image_picker_windows�[0m
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.
I've seen the PR that prepares the repo to land this. (I still think this might need a higher version number.)
We don't consider adding consts to be a semver breaking change, but you're right that a minor change is a better match in semver for this—it's an API change, but a compatible one (other than lints)—so 2.2.0 sounds good. |
Hi guys, thanks for the feedback, I applied all the requested changes, I hope this looks good for you. |
This LGTM, but #6463 needs to land first so this can land without errors in CI. |
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.
LGTM with one nit.
You'll need to merge in main
now so that analyze
will pass.
|
||
* Makes XTypeGroup constant and changes the initialization of it. |
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 second part of this is confusing since it's only referring to tests. How about just
* Makes `XTypeGroup`'s constructor constant.
7cd2fd0
to
12e9583
Compare
auto label is removed for flutter/plugins, pr: 6476, due to - The status or check suite legacy-version-analyze CHANNEL:2.10.5 has failed. Please fix the issues identified (or deflake) before re-applying this label.
|
Looks like the other PR missed a few. |
Hi Stuart, the pipeline informs that image_picker_windows is having issues with the lint, do you want me to open another PR to fix that? |
I don't follow the question; both runs that you linked to report the same set of failures. There's apparently another lint violation that you didn't suppress. You should run |
Hello Stuart, we're creating a PR to fix the lint issues on the image_picker_windows and another one to fix the new lint issues related to |
It's okay to do a file-level ignore since this should be very short-lived. |
12e9583
to
4bffe59
Compare
4bffe59
to
4d1f556
Compare
Within the file_selector_platform_interface, XTypeGroup constructor was converted to
const
, meaning that from now on, this object needs to be constructed usingconst
.Issue:
#111906 [file_selector]
XTypeGroup
should be immutableRelated PR:
#6463 Annotate all creation of XTypeGroup with // ignore: prefer_const_contructor
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.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.