deleteProfile static method

Future<void> deleteProfile({
  1. MBManager? manager,
})

Deletes the profile for the current logged in user.

  • Parameters:
    • manager: An optional MBManager used to make calls instead of MBManager.shared.
  • Returns a Future that completes when the profile is deleted correctly.

Implementation

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

  String apiName = 'api/profile/delete';

  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.delete(
    uri,
    headers: headers,
  );

  MBManager.checkResponse(response.body, checkBody: false);
  await _setUserLoggedOut();
}