Skip to content

Commit 7168c48

Browse files
committed
user [nfc]: Document users map, especially its incompleteness
1 parent af10aea commit 7168c48

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/model/user.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ import '../api/model/model.dart';
44

55
/// The portion of [PerAccountStore] describing the users in the realm.
66
mixin UserStore {
7+
/// All known users in the realm, by [User.userId].
8+
///
9+
/// There may be other users not found in this map, for multiple reasons:
10+
///
11+
/// * The self-user may not have permission to see all the users in the
12+
/// realm, for example because the self-user is a guest.
13+
///
14+
/// * Because of the fetch/event race, any data that the client fetched
15+
/// outside of the event system may reflect an earlier or later time
16+
/// than this data, which is maintained by the event system.
17+
/// This includes messages fetched for a message list, and notifications.
18+
/// Those may therefore refer to users for which we have yet to see the
19+
/// [RealmUserAddEvent], or have already handled a [RealmUserRemoveEvent].
20+
///
21+
/// Code that looks up a user in this map should therefore always handle
22+
/// the possibility that the user is not found (except
23+
/// where there is a specific reason to know the user should be found).
24+
/// Consider using [ZulipLocalizations.unknownUserName].
725
Map<int, User> get users;
826
}
927

0 commit comments

Comments
 (0)