WebserviceHelper<T> constructor

WebserviceHelper<T>({
  1. required EndpointType endPointType,
  2. T? itemFromJson(
    1. Map<String, dynamic>
    )?,
  3. Map<String, dynamic>? params,
  4. Map<String, dynamic>? queryParameters,
  5. FormData? formData,
  6. List<String>? path,
  7. ProgressCallback? onSendProgress,
  8. ProgressCallback? onReceiveProgress,
  9. CancelToken? cancelToken,
})

Implementation

WebserviceHelper({
  required this.endPointType,
  this.itemFromJson,
  this.params,
  this.queryParameters,
  this.formData,
  this.path,
  this.onSendProgress,
  this.onReceiveProgress,
  this.cancelToken,
}) {
  _dio = Dio(
    BaseOptions(
      baseUrl: endPointType.url,
      receiveDataWhenStatusError: true,
      headers: endPointType.headers,
      connectTimeout: const Duration(seconds: 60),
      receiveTimeout: const Duration(seconds: 60),
      validateStatus: (statusCode) {
        log('statusCode: $statusCode');
        if (statusCode == null) {
          return false;
        }
        return true;
      },
    ),
  );
}