head<T> method

  1. @override
Future<Result<T>> head<T>(
  1. String path, {
  2. dynamic data,
  3. Map<String, dynamic>? queryParameters,
  4. FutureOr<T> onSuccess(
    1. dynamic data
    )?,
  5. FutureOr<T> onError(
    1. dynamic data
    )?,
  6. RestApiClientRequestOptions? options,
})
override

Implementation

@override
Future<Result<T>> head<T>(
  String path, {
  data,
  Map<String, dynamic>? queryParameters,
  FutureOr<T> Function(dynamic data)? onSuccess,
  FutureOr<T> Function(dynamic data)? onError,
  RestApiClientRequestOptions? options,
}) async {
  try {
    final response = await _dio.head(
      path,
      queryParameters: queryParameters,
      data: data,
      options: options?.toOptions(),
    );

    return NetworkResult(
      response: response,
      data: await _resolveResult(response.data, onSuccess),
    );
  } on DioException catch (e) {
    await exceptionHandler.handle(e, silent: options?.silentException);

    return NetworkResult(
      response: e.response,
      exception: e,
      statusCode: e.response?.statusCode,
      statusMessage: e.response?.statusMessage,
    );
  }
}