getUser method
Implementation
Future<UserModel> getUser(String userId) async {
try {
final snapshot = await _db.collection('Users').doc(userId).get();
if (snapshot.data() != null) {
final model = await UserModel.fromDocumentSnapshot(snapshot);
return model;
}
throw UserDataServiceException(
code: RdevCode.NotFound,
message: 'User with id:${userId} was not found');
} catch (err) {
if (err is UserDataServiceException) {
rethrow;
}
if (err is FirebaseException) {
throw UserDataServiceException.fromRdevException(err.toRdevException());
}
throw UserDataServiceException(message: err.toString());
}
}