Skip to content

[camera_platform_interface] Fix VideoRecordedEvent equality and hashCode - #13452

Open
ChandraChaan wants to merge 4 commits into
flutter:mainfrom
ChandraChaan:camera-video-recorded-event-equality
Open

ChandraChaan wants to merge 4 commits into
flutter:mainfrom
ChandraChaan:camera-video-recorded-event-equality

Conversation

@ChandraChaan

@ChandraChaan ChandraChaan commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

VideoRecordedEvent.operator == ignores file, while hashCode hashes the XFile instance. Because XFile has no value equality, equal events can have different hash codes (for example, an event and its fromJson(toJson()) round-trip), and events for different files compare equal.

This compares and hashes file.path in both, matching how toJson/fromJson already identify the file, and adds tests for equal events, events with different paths, and a JSON round-trip.

Fixes flutter/flutter#195396

Pre-Review Checklist

@ChandraChaan
ChandraChaan marked this pull request as ready for review November 11, 2026 03:10

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the VideoRecordedEvent class in camera_platform_interface to compare file.path instead of the file object itself in its equality (==) operator and hashCode getter. It also adds corresponding unit tests to verify this behavior, bumps the package version to 2.15.1, and updates the changelog. There are no review comments, and I have no feedback to provide.

@ChandraChaan

Copy link
Copy Markdown
Contributor Author

Hi @bparrishMines, this is out of draft now and ready for review (it was waiting on the open PR limit).

It is a small fix for flutter/flutter#195396: VideoRecordedEvent compares and hashes file.path in == and hashCode, with tests for equal events, different paths and a JSON round-trip. Would you be able to take a look, or point me to the right reviewer if that is not you?

It will also need the CICD label before the presubmits can run. Thanks!

…a-video-recorded-event-equality

# Conflicts:
#	packages/camera/camera_platform_interface/CHANGELOG.md
@ChandraChaan

Copy link
Copy Markdown
Contributor Author

Gentle follow-up on this one, @bparrishMines. Since my last comment I resolved a CHANGELOG conflict with main (the ## NEXT SDK bump is folded into the 2.15.1 section), and the package tests, analyzer and format check all pass locally. It is a small change, so it should be a quick review. If someone else is better placed to review camera_platform_interface, please let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[camera_platform_interface] VideoRecordedEvent == and hashCode disagree

1 participant