getUser method

  1. @override
Future<TimelinePosterUserModel?> getUser(
  1. String userId
)

Implementation

@override
Future<TimelinePosterUserModel?> getUser(String userId) async {
  if (_users.containsKey(userId)) {
    return _users[userId]!;
  }
  var data = (await _userCollection.doc(userId).get()).data();

  var user = data == null
      ? TimelinePosterUserModel(userId: userId)
      : TimelinePosterUserModel(
          userId: userId,
          firstName: data.firstName,
          lastName: data.lastName,
          imageUrl: data.imageUrl,
        );

  _users[userId] = user;

  return user;
}