get method

  1. @override
Future<ChatResult<ChatUser>> get(
  1. String userId, {
  2. CachePolicy? cachePolicy,
})
override

Fetches a single user by ID.

Use to hydrate the "other user" row in a 1:1 chat or to enrich member lists with display name + avatar. cachePolicy defaults to networkFirst; pass cacheFirst for hot paths (message bubbles) and networkOnly when you need an authoritative snapshot (e.g. settings page showing your own current profile).

final res = await client.users.get(otherUserId);
res.dataOrNull?.let((u) => controller.addOtherUser(u));

Implementation

@override
Future<ChatResult<ChatUser>> get(
  String userId, {
  CachePolicy? cachePolicy,
}) async {
  final user = _client._users[userId];
  if (user == null) return const ChatFailureResult(NotFoundFailure());
  return ChatSuccess(user);
}