Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
knaeckeKami committed Jun 17, 2024
1 parent 2b6422d commit 1f18fca
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions dio/lib/src/dio_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ abstract class DioMixin implements Dio {
/// 50 KB of data should take 2-3 ms to parse on a Moto G4, and about 400 μs
/// on a Pixel 4.
@override
Transformer transformer = FusedTransformer(contentLengthIsolateThreshold: 50 * 1024);
Transformer transformer =
FusedTransformer(contentLengthIsolateThreshold: 50 * 1024);

bool _closed = false;

Expand Down Expand Up @@ -436,7 +437,8 @@ abstract class DioMixin implements Dio {

// The request has already been cancelled,
// there is no need to listen for another cancellation.
if (state.data is DioException && state.data.type == DioExceptionType.cancel) {
if (state.data is DioException &&
state.data.type == DioExceptionType.cancel) {
return handleError();
}
if (state.type == InterceptorResultType.next ||
Expand All @@ -458,8 +460,9 @@ abstract class DioMixin implements Dio {

// Add request interceptors into the request flow.
for (final interceptor in interceptors) {
final fun =
interceptor is QueuedInterceptor ? interceptor._handleRequest : interceptor.onRequest;
final fun = interceptor is QueuedInterceptor
? interceptor._handleRequest
: interceptor.onRequest;
future = future.then(requestInterceptorWrapper(fun));
}

Expand All @@ -481,14 +484,17 @@ abstract class DioMixin implements Dio {

// Add response interceptors into the request flow
for (final interceptor in interceptors) {
final fun =
interceptor is QueuedInterceptor ? interceptor._handleResponse : interceptor.onResponse;
final fun = interceptor is QueuedInterceptor
? interceptor._handleResponse
: interceptor.onResponse;
future = future.then(responseInterceptorWrapper(fun));
}

// Add error handlers into the request flow.
for (final interceptor in interceptors) {
final fun = interceptor is QueuedInterceptor ? interceptor._handleError : interceptor.onError;
final fun = interceptor is QueuedInterceptor
? interceptor._handleError
: interceptor.onError;
future = future.catchError(errorInterceptorWrapper(fun));
}
// Normalize errors, converts errors to [DioException].
Expand Down Expand Up @@ -584,7 +590,8 @@ abstract class DioMixin implements Dio {
r' ABCDEFGHIJKLMNOPQRSTUVWXYZ ^_'
r'`abcdefghijklmnopqrstuvwxyz | ~ ';
for (final int codeUnit in token.codeUnits) {
if (codeUnit >= validChars.length || validChars.codeUnitAt(codeUnit) == 0x20) {
if (codeUnit >= validChars.length ||
validChars.codeUnitAt(codeUnit) == 0x20) {
return false;
}
}
Expand Down Expand Up @@ -617,7 +624,8 @@ abstract class DioMixin implements Dio {
return false;
});
} else if (data is FormData) {
options.headers[Headers.contentTypeHeader] = '${Headers.multipartFormDataContentType}; '
options.headers[Headers.contentTypeHeader] =
'${Headers.multipartFormDataContentType}; '
'boundary=${data.boundary}';
stream = data.finalize();
length = data.length;
Expand Down

0 comments on commit 1f18fca

Please sign in to comment.