We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
AutocompleteDataCache
1 parent c4744fb commit 8ac0e16Copy full SHA for 8ac0e16
lib/model/autocomplete.dart
@@ -455,13 +455,21 @@ class MentionAutocompleteQuery {
455
}
456
457
class AutocompleteDataCache {
458
+ final Map<int, String> _normalizedNamesByUser = {};
459
+
460
+ /// The lowercase `fullName` of [user].
461
+ String normalizedNameForUser(User user) {
462
+ return _normalizedNamesByUser[user.userId] ??= user.fullName.toLowerCase();
463
+ }
464
465
final Map<int, List<String>> _nameWordsByUser = {};
466
467
List<String> nameWordsForUser(User user) {
- return _nameWordsByUser[user.userId] ??= user.fullName.toLowerCase().split(' ');
468
+ return _nameWordsByUser[user.userId] ??= normalizedNameForUser(user).split(' ');
469
470
471
void invalidateUser(int userId) {
472
+ _normalizedNamesByUser.remove(userId);
473
_nameWordsByUser.remove(userId);
474
475
0 commit comments