getUserProfile static method
Returns the profile of the current user.
- Parameters:
manager
: An optionalMBManager
used to make calls instead ofMBManager.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);
}