Browse Source

neon: Serialize/deserialize requests async

pull/262/head
jld3103 2 years ago
parent
commit
c8211cc291
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 6
      packages/neon/neon/lib/src/utils/request_manager.dart

6
packages/neon/neon/lib/src/utils/request_manager.dart

@ -77,7 +77,7 @@ class RequestManager {
try { try {
subject.add( subject.add(
Result( Result(
unwrap(deserialize((await cache!.get(key))!)), unwrap(await compute(deserialize, (await cache!.get(key))!)),
null, null,
loading: true, loading: true,
cached: true, cached: true,
@ -91,7 +91,7 @@ class RequestManager {
try { try {
final response = await (disableTimeout ? call() : timeout(call)); 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))); subject.add(Result.success(unwrap(response)));
} catch (e, s) { } catch (e, s) {
debugPrint(e.toString()); debugPrint(e.toString());
@ -115,7 +115,7 @@ class RequestManager {
try { try {
subject.add( subject.add(
Result( Result(
unwrap(deserialize((await cache!.get(key))!)), unwrap(await compute(deserialize, (await cache!.get(key))!)),
null, null,
loading: false, loading: false,
cached: true, cached: true,

Loading…
Cancel
Save