getUser method

Future<GetUserDetail?> getUser()

Implementation

Future<GetUserDetail?> getUser() async {
  GetUserDetail? getUserDetail;

  String? sessionId = await CoreDb.instance().getSessionId();

  var uri = Uri.parse(
      '${APIMode.BASE_URL}api/v1/user/$sessionId?clientId=${ConscentInitializer.mClientId}');
  var response = await http.get(uri);

  if (response.statusCode == 200) {
    getUserDetail = GetUserDetail.fromJson(jsonDecode(response.body));
    return getUserDetail;
  } else {
    onPluginError(response.body);
  }
  return getUserDetail;
}