callBack method

Future<Response> callBack(
  1. String url, {
  2. required NetworkDiocallback_dio callback,
  3. Map<String, dynamic>? body,
  4. Map<String, String>? headers,
  5. NetworkRequestFile? requestFile,
  6. ProgressCallbackFastor? onSendProgress,
  7. ProgressCallbackFastor? onReceiveProgress,
  8. NetworkTypeDio? type,
  9. bool? isEnableLogDioPretty,
  10. int? timeOutSecond,
  11. bool? handleErrorXMLHttpRequest,
})

Implementation

Future<Response> callBack(String url,
    { required NetworkDiocallback_dio  callback,
      Map<String, dynamic>? body,
      Map<String, String>? headers,

    ///file
      NetworkRequestFile? requestFile,
      ProgressCallbackFastor? onSendProgress,
      ProgressCallbackFastor? onReceiveProgress,

      ///other
      NetworkTypeDio? type,
      bool? isEnableLogDioPretty ,
      int?  timeOutSecond,
      bool?  handleErrorXMLHttpRequest
    }) async {

  //set values
  this.url = url;
  this.type = type;
  this.requestFile = requestFile;
  this.timeOutSecond = timeOutSecond;

  // handler error
  handleErrorXMLHttpRequest ??= false;
  this.handleErrorXMLHttpRequest = handleErrorXMLHttpRequest;

  //log
  isEnableLogDioPretty ??= true  ; //default take test enviroment
  this.isEnableLogDioPretty = isEnableLogDioPretty;

  //set body and header
  if (body != null) this.body = body;
  if (headers != null) this.headers = headers;

  //edit headers
  this.headers = setDefaultHeader(headers);

  _setupNetworkTypeDefault();
  this.callback_dio = callback;

  _configureSetup();

  return await _chooseTypeNetworkThenStartService( onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress);
}