From 2d73192a4071c0c5fc56ed92e395f00f29bc1f44 Mon Sep 17 00:00:00 2001 From: Krille Date: Wed, 16 Oct 2024 15:13:30 +0200 Subject: [PATCH] refactor: Use Object.hash instead of hashCode ^ --- lib/src/voip/backend/livekit_backend.dart | 7 +++++-- lib/src/voip/models/call_membership.dart | 19 ++++++++++--------- lib/src/voip/models/call_participant.dart | 2 +- lib/src/voip/models/voip_id.dart | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/src/voip/backend/livekit_backend.dart b/lib/src/voip/backend/livekit_backend.dart index 1a958416..237f2285 100644 --- a/lib/src/voip/backend/livekit_backend.dart +++ b/lib/src/voip/backend/livekit_backend.dart @@ -462,8 +462,11 @@ class LiveKitBackend extends CallBackend { livekitAlias == other.livekitAlias; @override - int get hashCode => - type.hashCode ^ livekitServiceUrl.hashCode ^ livekitAlias.hashCode; + int get hashCode => Object.hash( + type.hashCode, + livekitServiceUrl.hashCode, + livekitAlias.hashCode, + ); /// get everything else from your livekit sdk in your client @override diff --git a/lib/src/voip/models/call_membership.dart b/lib/src/voip/models/call_membership.dart index 77c8735b..3e7c55fb 100644 --- a/lib/src/voip/models/call_membership.dart +++ b/lib/src/voip/models/call_membership.dart @@ -103,15 +103,16 @@ class CallMembership { membershipId == other.membershipId; @override - int get hashCode => - userId.hashCode ^ - roomId.hashCode ^ - callId.hashCode ^ - application.hashCode ^ - scope.hashCode ^ - backend.type.hashCode ^ - deviceId.hashCode ^ - membershipId.hashCode; + int get hashCode => Object.hash( + userId.hashCode, + roomId.hashCode, + callId.hashCode, + application.hashCode, + scope.hashCode, + backend.type.hashCode, + deviceId.hashCode, + membershipId.hashCode, + ); // with a buffer of 1 minute just incase we were slow to process a // call event, if the device is actually dead it should diff --git a/lib/src/voip/models/call_participant.dart b/lib/src/voip/models/call_participant.dart index 7ba2b490..0a587133 100644 --- a/lib/src/voip/models/call_participant.dart +++ b/lib/src/voip/models/call_participant.dart @@ -35,5 +35,5 @@ class CallParticipant { deviceId == other.deviceId; @override - int get hashCode => userId.hashCode ^ deviceId.hashCode; + int get hashCode => Object.hash(userId.hashCode, deviceId.hashCode); } diff --git a/lib/src/voip/models/voip_id.dart b/lib/src/voip/models/voip_id.dart index 19523b4b..61496202 100644 --- a/lib/src/voip/models/voip_id.dart +++ b/lib/src/voip/models/voip_id.dart @@ -20,5 +20,5 @@ class VoipId { other is VoipId && roomId == other.roomId && callId == other.callId; @override - int get hashCode => roomId.hashCode ^ callId.hashCode; + int get hashCode => Object.hash(roomId.hashCode, callId.hashCode); }