You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[camera_platform_interface] VideoRecordedEvent == and hashCode disagree #195396
final a =VideoRecordedEvent(1, XFile('/tmp/video.mp4'), null);
final b =VideoRecordedEvent(1, XFile('/tmp/video.mp4'), null);
print(a == b); // trueprint(a.hashCode == b.hashCode); // falsefinal c =VideoRecordedEvent(1, XFile('/tmp/other.mp4'), null);
print(a == c); // true
Expected results
Events that are == have the same hashCode, and events for different video files aren't equal.
Actual results
VideoRecordedEvent.operator == doesn't compare file, but hashCode hashes the XFile object itself. XFile has no value equality, so:
two events for the same recording (for example, one created by VideoRecordedEvent.fromJson) are == but have different hash codes, which breaks the ==/hashCode contract and makes them misbehave in sets and maps;
two events for different files compare equal.
Package version
camera_platform_interface 2.15.0 (main as of today)
Thanks for confirming! The fix is in flutter/packages#13452. Its tests cover both cases from your sample: equal events now have equal hash codes, and events with different files are no longer equal. It's a draft for now because I already have two open PRs in flutter/packages; I'll mark it ready for review as soon as one of them lands.
Activity
suryaKommana2662 commentedon Oct 27, 2026
@ChandraChaan Thanks for the report. I was able to reproduce the issue locally. Routing to team-ecosystem for further investigation.
Reproduction code
Output:
Flutter Doctor Output
ChandraChaan commentedon Oct 27, 2026
Thanks for confirming! The fix is in flutter/packages#13452. Its tests cover both cases from your sample: equal events now have equal hash codes, and events with different files are no longer equal. It's a draft for now because I already have two open PRs in flutter/packages; I'll mark it ready for review as soon as one of them lands.