Skip to content

Commit

Permalink
Convert to super params
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhnroyal committed Dec 20, 2023
1 parent 69f8bd1 commit 65be705
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 71 deletions.
104 changes: 34 additions & 70 deletions dio/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,27 @@ mixin OptionsMixin {
/// The base config for the Dio instance, used by [Dio.options].
class BaseOptions extends _RequestConfig with OptionsMixin {
BaseOptions({
String? method,
super.method,
Duration? connectTimeout,
Duration? receiveTimeout,
Duration? sendTimeout,
super.receiveTimeout,
super.sendTimeout,
String baseUrl = '',
Map<String, dynamic>? queryParameters,
Map<String, dynamic>? extra,
Map<String, dynamic>? headers,
bool preserveHeaderCase = false,
ResponseType? responseType = ResponseType.json,
String? contentType,
ValidateStatus? validateStatus,
bool? receiveDataWhenStatusError,
bool? followRedirects,
int? maxRedirects,
bool? persistentConnection,
RequestEncoder? requestEncoder,
ResponseDecoder? responseDecoder,
ListFormat? listFormat,
super.extra,
super.headers,
bool super.preserveHeaderCase = false,
super.responseType = ResponseType.json,
super.contentType,
super.validateStatus,
super.receiveDataWhenStatusError,
super.followRedirects,
super.maxRedirects,
super.persistentConnection,
super.requestEncoder,
super.responseDecoder,
super.listFormat,
}) : assert(connectTimeout == null || !connectTimeout.isNegative),
assert(baseUrl.isEmpty || Uri.parse(baseUrl).host.isNotEmpty),
super(
method: method,
receiveTimeout: receiveTimeout,
sendTimeout: sendTimeout,
extra: extra,
headers: headers,
preserveHeaderCase: preserveHeaderCase,
responseType: responseType,
contentType: contentType,
validateStatus: validateStatus,
receiveDataWhenStatusError: receiveDataWhenStatusError,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
persistentConnection: persistentConnection,
requestEncoder: requestEncoder,
responseDecoder: responseDecoder,
listFormat: listFormat,
) {
assert(baseUrl.isEmpty || Uri.parse(baseUrl).host.isNotEmpty) {
this.queryParameters = queryParameters ?? {};
this.baseUrl = baseUrl;
this.connectTimeout = connectTimeout;
Expand Down Expand Up @@ -488,46 +470,28 @@ class RequestOptions extends _RequestConfig with OptionsMixin {
this.onReceiveProgress,
this.onSendProgress,
this.cancelToken,
String? method,
Duration? sendTimeout,
Duration? receiveTimeout,
super.method,
super.sendTimeout,
super.receiveTimeout,
Duration? connectTimeout,
Map<String, dynamic>? queryParameters,
String? baseUrl,
Map<String, dynamic>? extra,
Map<String, dynamic>? headers,
bool? preserveHeaderCase,
ResponseType? responseType,
String? contentType,
ValidateStatus? validateStatus,
bool? receiveDataWhenStatusError,
bool? followRedirects,
int? maxRedirects,
bool? persistentConnection,
RequestEncoder? requestEncoder,
ResponseDecoder? responseDecoder,
ListFormat? listFormat,
super.extra,
super.headers,
super.preserveHeaderCase,
super.responseType,
super.contentType,
super.validateStatus,
super.receiveDataWhenStatusError,
super.followRedirects,
super.maxRedirects,
super.persistentConnection,
super.requestEncoder,
super.responseDecoder,
super.listFormat,
bool? setRequestContentTypeWhenNoPayload,
StackTrace? sourceStackTrace,
}) : assert(connectTimeout == null || !connectTimeout.isNegative),
super(
method: method,
sendTimeout: sendTimeout,
receiveTimeout: receiveTimeout,
extra: extra,
headers: headers,
preserveHeaderCase: preserveHeaderCase,
responseType: responseType,
contentType: contentType,
validateStatus: validateStatus,
receiveDataWhenStatusError: receiveDataWhenStatusError,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
persistentConnection: persistentConnection,
requestEncoder: requestEncoder,
responseDecoder: responseDecoder,
listFormat: listFormat,
) {
}) : assert(connectTimeout == null || !connectTimeout.isNegative) {
this.sourceStackTrace = sourceStackTrace ?? StackTrace.current;
this.queryParameters = queryParameters ?? {};
this.baseUrl = baseUrl ?? '';
Expand Down
2 changes: 1 addition & 1 deletion dio/test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ final Matcher throwsDioExceptionConnectionError = throwsA(

/// A stream of chunks of bytes representing a single piece of data.
class ByteStream extends StreamView<List<int>> {
ByteStream(Stream<List<int>> stream) : super(stream);
ByteStream(super.stream);

/// Returns a single-subscription byte stream that will emit the given bytes
/// in a single chunk.
Expand Down

0 comments on commit 65be705

Please sign in to comment.