Skip to content

Commit 53d8224

Browse files
author
Franco Bugnano
committed
Update the deprecated hashing functions.
1 parent b7d6d0a commit 53d8224

File tree

4 files changed

+26
-31
lines changed

4 files changed

+26
-31
lines changed

lib/src/chatoptions.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:convert';
2-
import 'dart:ui';
32

43
import './chatbox.dart';
54

@@ -101,7 +100,7 @@ class MessageFieldOptions {
101100
return true;
102101
}
103102

104-
int get hashCode => hashValues(autofocus, enterSendsMessage, placeholder, spellcheck);
103+
int get hashCode => Object.hash(autofocus, enterSendsMessage, placeholder, spellcheck);
105104
}
106105

107106
/// The possible values for showTranslationToggle
@@ -253,7 +252,7 @@ class ChatBoxOptions {
253252
return true;
254253
}
255254

256-
int get hashCode => hashValues(
255+
int get hashCode => Object.hash(
257256
dir,
258257
messageField,
259258
showChatHeader,

lib/src/conversation.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:ui';
2-
31
import 'package:flutter/foundation.dart';
42

53
import './session.dart';
@@ -76,7 +74,7 @@ class Participant {
7674
return true;
7775
}
7876

79-
int get hashCode => hashValues(user, access, notify);
77+
int get hashCode => Object.hash(user, access, notify);
8078
}
8179

8280
/// This represents a conversation that is about to be created, fetched, or
@@ -201,13 +199,13 @@ class Conversation extends _BaseConversation {
201199
return true;
202200
}
203201

204-
int get hashCode => hashValues(
202+
int get hashCode => Object.hash(
205203
_session,
206-
hashList(participants),
204+
Object.hashAll(participants),
207205
id,
208-
(custom != null ? hashList(custom!.keys) : custom),
209-
(custom != null ? hashList(custom!.values) : custom),
210-
(welcomeMessages != null ? hashList(welcomeMessages) : welcomeMessages),
206+
(custom != null ? Object.hashAll(custom!.keys) : custom),
207+
(custom != null ? Object.hashAll(custom!.values) : custom),
208+
(welcomeMessages != null ? Object.hashAll(welcomeMessages!) : welcomeMessages),
211209
photoUrl,
212210
subject,
213211
);

lib/src/predicate.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:convert';
2-
import 'dart:ui';
32

43
import 'package:flutter/foundation.dart';
54

@@ -63,10 +62,10 @@ class FieldPredicate<T> {
6362
return true;
6463
}
6564

66-
int get hashCode => hashValues(
65+
int get hashCode => Object.hash(
6766
_operand,
6867
_value,
69-
(_values != null ? hashList(_values) : _values),
68+
(_values != null ? Object.hashAll(_values!) : _values),
7069
);
7170
}
7271

@@ -121,10 +120,10 @@ class CustomFieldPredicate extends FieldPredicate<String> {
121120
return true;
122121
}
123122

124-
int get hashCode => hashValues(
123+
int get hashCode => Object.hash(
125124
_operand,
126125
_value,
127-
(_values != null ? hashList(_values) : _values),
126+
(_values != null ? Object.hashAll(_values!) : _values),
128127
_exists,
129128
);
130129
}
@@ -206,10 +205,10 @@ class ConversationPredicate {
206205
return true;
207206
}
208207

209-
int get hashCode => hashValues(
208+
int get hashCode => Object.hash(
210209
access,
211-
(custom != null ? hashList(custom!.keys) : custom),
212-
(custom != null ? hashList(custom!.values) : custom),
210+
(custom != null ? Object.hashAll(custom!.keys) : custom),
211+
(custom != null ? Object.hashAll(custom!.values) : custom),
213212
hasUnreadMessages,
214213
);
215214
}
@@ -309,10 +308,10 @@ class SenderPredicate {
309308
return true;
310309
}
311310

312-
int get hashCode => hashValues(
311+
int get hashCode => Object.hash(
313312
id,
314-
(custom != null ? hashList(custom!.keys) : custom),
315-
(custom != null ? hashList(custom!.values) : custom),
313+
(custom != null ? Object.hashAll(custom!.keys) : custom),
314+
(custom != null ? Object.hashAll(custom!.values) : custom),
316315
locale,
317316
role,
318317
);
@@ -395,9 +394,9 @@ class MessagePredicate {
395394
return true;
396395
}
397396

398-
int get hashCode => hashValues(
399-
(custom != null ? hashList(custom!.keys) : custom),
400-
(custom != null ? hashList(custom!.values) : custom),
397+
int get hashCode => Object.hash(
398+
(custom != null ? Object.hashAll(custom!.keys) : custom),
399+
(custom != null ? Object.hashAll(custom!.values) : custom),
401400
origin,
402401
sender,
403402
type,

lib/src/user.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:convert';
2-
import 'dart:ui';
32

43
import 'package:flutter/foundation.dart';
54

@@ -232,14 +231,14 @@ class User extends _BaseUser {
232231
return true;
233232
}
234233

235-
int get hashCode => hashValues(
234+
int get hashCode => Object.hash(
236235
_session,
237236
_idOnly,
238237
availabilityText,
239-
(custom != null ? hashList(custom!.keys) : custom),
240-
(custom != null ? hashList(custom!.values) : custom),
241-
(email != null ? hashList(email) : email),
242-
(phone != null ? hashList(phone) : phone),
238+
(custom != null ? Object.hashAll(custom!.keys) : custom),
239+
(custom != null ? Object.hashAll(custom!.values) : custom),
240+
(email != null ? Object.hashAll(email!) : email),
241+
(phone != null ? Object.hashAll(phone!) : phone),
243242
id,
244243
name,
245244
locale,

0 commit comments

Comments
 (0)