findUserById method

  1. @override
Future<FindUserResponse> findUserById(
  1. String userId
)

Returns a FindUserResponse for user with userId

Upon success a User object is provided and error is set to null

In case of error a ResponseError is set and no User is provided

Implementation

@override
Future<FindUserResponse> findUserById(String userId) {
  return catchSqlError<FindUserResponse>(
      store.userDao.findById(userId).then((value) => value != null
          ? FindUserResponse(user: value)
          : FindUserResponse(
              error: ResponseError.notFound(
                  message: 'User $userId not found',
                  context: contextUser,
                  target: userId))),
      (sqle) => FindUserResponse(
          error: toResponseError(sqle, context: contextUser, target: userId)),
      options);
}