From 5af08398a18b8b07ef01f3df3567e645bd372ade Mon Sep 17 00:00:00 2001 From: Nikolas Rimikis Date: Tue, 23 May 2023 18:32:39 +0200 Subject: [PATCH] dynamite, neon: fix plain object deserialization --- packages/dynamite/dynamite/lib/src/type_result/base.dart | 8 +------- packages/nextcloud/lib/src/nextcloud.openapi.dart | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/type_result/base.dart b/packages/dynamite/dynamite/lib/src/type_result/base.dart index e78a1a1c..a9e93996 100644 --- a/packages/dynamite/dynamite/lib/src/type_result/base.dart +++ b/packages/dynamite/dynamite/lib/src/type_result/base.dart @@ -21,13 +21,7 @@ class TypeResultBase extends TypeResult { name == 'String' ? object : '$object.toString()'; @override - String deserialize(final String object, {final bool toBuilder = false}) { - if (name == 'JsonObject') { - return 'JsonObject($object)${nullable ? '?' : ''}'; - } - - return '($object as $nullableName)'; - } + String deserialize(final String object, {final bool toBuilder = false}) => '($object as $nullableName)'; @override String decode(final String object) { diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 4430686a..0bf64f68 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -463,7 +463,7 @@ class NextcloudCoreClient { body, ); if (response.statusCode == 200) { - return JsonObject(JsonObject(utf8.decode(response.body))); + return JsonObject(utf8.decode(response.body)); } throw NextcloudApiException.fromResponse(response); // coverage:ignore-line }