[camera_platform_interface] Add rgba8888 format to ImageFormatGroup#11765
[camera_platform_interface] Add rgba8888 format to ImageFormatGroup#11765Mairramer wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds the rgba8888 format to the ImageFormatGroup enum and implements platform-specific mappings for Android and iOS. Review feedback recommends adding unit tests to verify the conversion of platform-specific integer values and updating documentation links for consistency with existing code.
…format_group.dart Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
bparrishMines
left a comment
There was a problem hiding this comment.
LGTM
@stuartmorgan-g or @tarrinneal for secondary review
|
The addition looks good, but the two switch analyzer errors will need temporary |
… and AVFoundation
Done. |
|
You added case handling, not ignores. That will fail our safety check against modifying code across dependency layers in a federated plugin. You need to ignore the warning in this PR, and add the cases in the next PR. |
Yes, I messed up. I'll fix it right away. |
|
@stuartmorgan-g I believe it should pass now, hopefully. |
|
I'm very confused by the compile error here; I thought this was only an analyzer warning as long as it wasn't a switch expression (e.g., |
|
Wow, apparently it changed several years ago for enums and we hadn't hit it until now. So there will need to be a prequel PR to change all of those constructions to use |
How to proceed in this case? |
|
Specifically, all the code in those util files that does: switch (foo) {
...
}
// 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 bar;Will need to become: return switch(foo) {
...
// 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.
// ignore: no_default_cases, unreachable_switch_default
default:
bar;
}And that will need to land in a separate PR before this one can land. |
|
Oh, but that's not enough, because it would still break the existing versions. So despite our intentions, adding an enum value is breaking for our existing implementation code. I think we'll need to do a one-time breaking change to the platform interface, as much as I hate to do that. We can add a private enum value to each of the enums that we want to be able to extend in that breaking change, to force clients not to rely on exhaustive matching. @bparrishMines Can you think of any better options? (Alternately we could ship the implementation change, wait a while, assume that it's very unlikely that anyone would be on an old implementation package version but get a new platform interface version, and then change it without a major version bump, but I don't think we should do that since it violates the intent of using semver.) |
Part of #11632
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2