From c8211cc291869a3c0fc559b3346c184897c944bd Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sat, 22 Apr 2023 20:33:27 +0200 Subject: [PATCH] neon: Serialize/deserialize requests async --- packages/neon/neon/lib/src/utils/request_manager.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/neon/neon/lib/src/utils/request_manager.dart b/packages/neon/neon/lib/src/utils/request_manager.dart index 6865140c..2dccced7 100644 --- a/packages/neon/neon/lib/src/utils/request_manager.dart +++ b/packages/neon/neon/lib/src/utils/request_manager.dart @@ -77,7 +77,7 @@ class RequestManager { try { subject.add( Result( - unwrap(deserialize((await cache!.get(key))!)), + unwrap(await compute(deserialize, (await cache!.get(key))!)), null, loading: true, cached: true, @@ -91,7 +91,7 @@ class RequestManager { try { final response = await (disableTimeout ? call() : timeout(call)); - await cache?.set(key, serialize(response)); + await cache?.set(key, await compute(serialize, response)); subject.add(Result.success(unwrap(response))); } catch (e, s) { debugPrint(e.toString()); @@ -115,7 +115,7 @@ class RequestManager { try { subject.add( Result( - unwrap(deserialize((await cache!.get(key))!)), + unwrap(await compute(deserialize, (await cache!.get(key))!)), null, loading: false, cached: true,