From f24f9e838b3125c57e1838dd5141361a6a06e81c Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 21 Dec 2022 10:19:30 +0100 Subject: [PATCH] dynamite,nextcloud,neon: Suffix serialize and deserialize functions --- packages/dynamite/lib/src/openapi_builder.dart | 4 ++-- packages/neon/lib/src/utils/request_manager.dart | 6 +++--- packages/nextcloud/lib/src/nextcloud.openapi.dart | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/lib/src/openapi_builder.dart index 4246edec..3682aba4 100644 --- a/packages/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/lib/src/openapi_builder.dart @@ -865,9 +865,9 @@ class OpenAPIBuilder implements Builder { ], '};', '', - 'T deserialize(final dynamic data) => _deserializers[T]!(data) as T;', + 'T deserialize$prefix(final dynamic data) => _deserializers[T]!(data) as T;', '', - 'dynamic serialize(final T data) => _serializers[T]!(data);', + 'dynamic serialize$prefix(final T data) => _serializers[T]!(data);', '// coverage:ignore-end', ]); } diff --git a/packages/neon/lib/src/utils/request_manager.dart b/packages/neon/lib/src/utils/request_manager.dart index 8eb8eb59..8feb6bc6 100644 --- a/packages/neon/lib/src/utils/request_manager.dart +++ b/packages/neon/lib/src/utils/request_manager.dart @@ -34,7 +34,7 @@ class RequestManager { try { subject.add( Result( - unwrap(deserialize(json.decode((await cache!.get(key))!))), + unwrap(deserializeNextcloud(json.decode((await cache!.get(key))!))), null, loading: true, cached: true, @@ -48,7 +48,7 @@ class RequestManager { try { final response = await (disableTimeout ? call() : timeout(call)); - await cache?.set(key, json.encode(serialize(response))); + await cache?.set(key, json.encode(serializeNextcloud(response))); subject.add(Result.success(unwrap(response))); } catch (e, s) { debugPrint(e.toString()); @@ -57,7 +57,7 @@ class RequestManager { try { subject.add( Result( - unwrap(deserialize(json.decode((await cache!.get(key))!))), + unwrap(deserializeNextcloud(json.decode((await cache!.get(key))!))), null, loading: false, cached: true, diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index fee305e9..eea43209 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -6041,7 +6041,7 @@ final _serializers = { data.map((final e) => e.toJson()).toList(), }; -T deserialize(final dynamic data) => _deserializers[T]!(data) as T; +T deserializeNextcloud(final dynamic data) => _deserializers[T]!(data) as T; -dynamic serialize(final T data) => _serializers[T]!(data); +dynamic serializeNextcloud(final T data) => _serializers[T]!(data); // coverage:ignore-end