deleteUser static method

Future<bool> deleteUser({
  1. dynamic errorCallback(
    1. int? errorCode,
    2. String? errorMessage
    )?,
})

Implementation

static Future<bool> deleteUser(
    {
      Function(int? errorCode, String? errorMessage)? errorCallback
    }) async
{
  if (!_isInitialized(errorCallback: errorCallback)) { return false; }
  if (!_checkAuthInfo(errorCallback: errorCallback)) { return false; }
  try {
    String url = "/users/delete";
    await HttpUtil.delete(url);
    stopNotificationWebSocket();
    _mUser = null;
    await HttpUtil.removeAllSessionData();
    return true;
  } on TPException catch(e) {
    Logger.log("$e");
    if(errorCallback != null) { errorCallback(e.getCode(), e.getMessage()); }
  } catch(e){
    Logger.log("$e");
    if(errorCallback != null) { errorCallback(-1, e.toString()); }
  }
  return false;
}