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 0a0c4aa commit e0e3626
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dio/lib/src/transformers/fused_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class FusedTransformer extends Transformer {
FusedTransformer({this.contentLengthIsolateThreshold = -1});

/// Always decode the response in the same isolate
factory FusedTransformer.sync() => FusedTransformer(contentLengthIsolateThreshold: -1);
factory FusedTransformer.sync() =>
FusedTransformer(contentLengthIsolateThreshold: -1);

// whether to switch decoding to an isolate for large responses
// set to -1 to disable, 0 to always use isolate
Expand Down Expand Up @@ -104,9 +105,11 @@ class FusedTransformer extends Transformer {
RequestOptions options,
ResponseBody responseBody,
) async {
final contentLengthHeader = responseBody.headers[Headers.contentLengthHeader];
final contentLengthHeader =
responseBody.headers[Headers.contentLengthHeader];

final hasContentLengthHeader = contentLengthHeader != null && contentLengthHeader.isNotEmpty;
final hasContentLengthHeader =
contentLengthHeader != null && contentLengthHeader.isNotEmpty;

// The content length of the response, either from the content-length header
// of the response or the length of the eagerly decoded response bytes
Expand Down Expand Up @@ -136,8 +139,8 @@ class FusedTransformer extends Transformer {
// - the content length, calculated from either
// the content-length header if present or the eagerly decoded response bytes,
// is greater than or equal to contentLengthIsolateThreshold
final shouldUseIsolate =
!(contentLengthIsolateThreshold < 0) && contentLength >= contentLengthIsolateThreshold;
final shouldUseIsolate = !(contentLengthIsolateThreshold < 0) &&
contentLength >= contentLengthIsolateThreshold;
if (shouldUseIsolate) {
// we can't send the stream to the isolate, so we need to decode the response bytes first
return compute(
Expand Down

0 comments on commit e0e3626

Please sign in to comment.