getCurrentUser static method

Future<AuthResult> getCurrentUser([
  1. bool? customData,
  2. bool? identities,
  3. bool? departmentIds
])

get current logged in user's profile.

Implementation

static Future<AuthResult> getCurrentUser(
    [bool? customData, bool? identities, bool? departmentIds]) async {
  bool customDataBool = customData == null ? false : true;
  bool identitiesBool = identities == null ? false : true;
  bool departmentIdsBool = departmentIds == null ? false : true;
  String url = '/api/v3/get-profile?withCustomData=' +
      customDataBool.toString() +
      '&withIdentities=' +
      identitiesBool.toString() +
      '&withDepartmentIds=' +
      departmentIdsBool.toString();
  final Result result = await get(url);

  AuthResult authResult = AuthResult(result);
  authResult.user = await createUser(result);

  return authResult;
}