From 2cec2ed5395b58699aac6ef20200682321e25fca Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Sun, 19 Nov 2023 12:07:22 +0100 Subject: [PATCH] perf(dynamite_runtime): DynamiteRawResponse deserialize headers while waiting for the body Signed-off-by: Nikolas Rimikis --- .../dynamite/dynamite_runtime/lib/src/dynamite_client.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/dynamite/dynamite_runtime/lib/src/dynamite_client.dart b/packages/dynamite/dynamite_runtime/lib/src/dynamite_client.dart index 4ebb10f0..6ace5778 100644 --- a/packages/dynamite/dynamite_runtime/lib/src/dynamite_client.dart +++ b/packages/dynamite/dynamite_runtime/lib/src/dynamite_client.dart @@ -73,15 +73,15 @@ class DynamiteRawResponse { // ignore: discarded_futures response.then( (final response) async { + _rawHeaders = response.responseHeaders; + final headers = deserializeHeaders(_rawHeaders, serializers, headersType); + _rawBody = switch (bodyType) { const FullType(Uint8List) => await response.bytes, const FullType(String) => await response.string, _ => await response.json, }; - _rawHeaders = response.responseHeaders; - final body = deserializeBody(_rawBody, serializers, bodyType); - final headers = deserializeHeaders(_rawHeaders, serializers, headersType); _response = DynamiteResponse( response.statusCode,