XHttp class

Global network request dio instance singleton XHttp Store api endpoint URL in lib/url.dart' like : {@tool snippet}

class Urls {
 static const BASE_URL = 'localhost/api';
}

{@end-tool} A simple get request is like ///{@tool snippet}

 void getRequest(){
    XHttp.request(Urls.BASE_URL, method: XHttp.GET);
  }

{@end-tool}

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String url, [Map<String, dynamic>? data, dynamic resultDialogConfig, bool isCancelWhiteList = false]) Future
downloadFile(dynamic urlPath, dynamic savePath, [dynamic resultDialogConfig, bool isCancelWhiteList = false]) Future
get(String url, [Map<String, dynamic>? params, dynamic resultDialogConfig, bool isCancelWhiteList = false]) Future
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(String url, [Map<String, dynamic>? data, dynamic resultDialogConfig, bool isCancelWhiteList = false]) Future
post(String url, [Map<String, dynamic>? data, dynamic resultDialogConfig, bool isCancelWhiteList = false]) Future
put(String url, [Map<String, dynamic>? data, dynamic resultDialogConfig, bool isCancelWhiteList = false]) Future
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

cancelToken ↔ CancelToken
getter/setter pair
dio ↔ Dio?
getter/setter pair
errorShowMsg String?
getter/setter pair
errorShowTitle String
getter/setter pair
loadMsg String
getter/setter pair
whiteListCancelToken ↔ CancelToken
getter/setter pair

Static Methods

cancelRequest() XHttp
cancelWhiteListRequest() XHttp
getAuthUser() Map<String, dynamic>?
getBaseUrl() String?
getCancelToken() → CancelToken
getHeader(String key) → dynamic
getHeaders() Map?
getInstance({String? baseUrl, String? msg}) XHttp
getNewCancelToken() → CancelToken
getRequestTimeout() Map
getWhiteListCancelToken() → CancelToken
removeAllHeaders() XHttp
removeHeader(String key) XHttp
request(String url, {String method = XHttp.GET, Map<String, dynamic>? queryParameters, Map<String, dynamic>? data, bool isCancelWhiteList = false, dynamic resultDialogConfig, Options? options, void onSendProgress(int, int)?, void onReceiveProgress(int, int)?, String? msg, String? baseUrl}) Future
setAuthToken([String? token]) XHttp
setBaseUrl(String baseUrl) XHttp
setConnectTimeout(int timeout) XHttp
setErrorTitle(String msg) XHttp
setHeader(String key, String value) XHttp
setHeaders(Map headers) XHttp
setReceiveTimeout(int timeout) XHttp
setRequestTimeout(int timeout) XHttp
setSendTimeout(int timeout) XHttp

Constants

CONNECT_TIMEOUT → const int
CUSTOM_ERROR_CODE → const String
DEFAULT_LOAD_MSG → const String
DELETE → const String
DIALOG_TYPE_ALERT → const String
DIALOG_TYPE_CUSTOM → const String
DIALOG_TYPE_OTHERS → const String
DIALOG_TYPE_TOAST → const String
ERROR_TYPE_STR → const String
GET → const String
PATCH → const String
POST → const String
PUT → const String
RECEIVE_TIMEOUT → const int
REQUEST_TYPE_STR → const String
RESPONSE_TYPE_STR → const String
SEND_TIMEOUT → const int