getUserProfile static method

Future<MBUser> getUserProfile({
  1. MBManager? manager,
})

Returns the profile of the current user.

  • Parameters:
    • manager: An optional MBManager used to make calls instead of MBManager.shared.
  • Returns a Future that completes with the profile of the current logged in user.

Implementation

static Future<MBUser> getUserProfile({
  MBManager? manager,
}) async {
  MBManager mbManager = manager ?? MBManager.shared;

  String apiName = 'api/profile';

  Map<String, String> apiParameters = await mbManager.defaultParameters();
  var uri = Uri.https(mbManager.endpoint, apiName, apiParameters);

  Map<String, String> headers = await mbManager.headers();

  http.Response response = await http.get(
    uri,
    headers: headers,
  );

  Map<String, dynamic> body = MBManager.checkResponse(response.body);
  return MBUser.fromDictionary(body);
}