delete method

Future<T> delete({
  1. required TGDeleteRequest request,
  2. dynamic onSuccess(
    1. dynamic T
    )?,
  3. dynamic onError(
    1. dynamic T
    )?,
})

Implementation

Future<T> delete(
    {required TGDeleteRequest request, onSuccess(T)?, onError(T)?}) async {
  try {
    Uri uri = Uri.parse(request.getUrl());
    TGLog.t("DELETE", uri);
    final httpRes = await _getClient(request.getUri(), "DELETE").delete(
      uri,
      body: request.body(),
      headers: request.headers(),
    );
    return _performCallback(httpRes, onError, onSuccess);
  } catch (error) {
    T t = _populateExceptionResponse(error);
    onError!(t);
    return t;
  }
}