getCallback<T> static method
dynamic
getCallback<T>(})
http GET request return Void params required callback function
Implementation
static getCallback<T>(String path,
{bool showLoading = false,
DioMethod method = DioMethod.get,
Map<String, dynamic>? params,
CancelToken? cancelToken,
Options? options,
required void Function(Response)? success,
void Function(DioException)? error,
Function? complete}) {
HttpUtils()
.request(path, showLoading: showLoading, method: method, params: params, options: options, cancelToken: cancelToken)
.then((value) {
if (success != null) {
success(value);
}
}).catchError((Object err) {
if (error != null) {
error(err as DioException);
}
}).whenComplete(() {
if (complete != null) {
complete();
}
});
}