getUser method

Future<UserData> getUser(
  1. String accessToken
)

Gets data associated with a user.

Takes the the access token of the user. Returns object containing properties associated with a user.

Implementation

Future<UserData> getUser(String accessToken) async {
  final uri = _urlBase.getPath(_baseUserEndpoint);

  final resp = await get(
    uri,
    headers: {
      URLBase.authHeader: accessToken,
    },
  );
  final bodyResp = await JsonIsolate().decodeJson(resp.body);
  if (resp.statusCode != 200) {
    throw bodyResp['description'];
  }
  return UserData.fromJson(bodyResp);
}