getUser method
- String id
Retrieves a user based on the ID.
Implementation
@override
Future<ChatUserModel?> getUser(String id) async {
if (_users.containsKey(id)) {
return _users[id]!;
}
return _userCollection.doc(id).get().then((response) {
var data = response.data();
var user = data == null
? ChatUserModel(id: id)
: ChatUserModel(
id: id,
firstName: data.firstName,
lastName: data.lastName,
imageUrl: data.imageUrl,
);
_users[id] = user;
return user;
});
}