diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/deserialize.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/deserialize.mustache index edb8887328c..da750aa02b1 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/deserialize.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/deserialize.mustache @@ -52,13 +52,13 @@ final _regMap = RegExp(r'^Map$'); .toSet() as ReturnType; } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments - return Map.fromIterables( - value.keys, + targetType = match![1]!.trim(); // ignore: parameter_assignments + return Map.fromIterables( + value.keys as Iterable, value.values.map((dynamic v) => deserialize(v, targetType, growable: growable)), ) as ReturnType; } break; - } + } throw Exception('Cannot deserialize'); } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart index 606d5e08f0d..af74c7ee5e4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart @@ -183,13 +183,13 @@ final _regMap = RegExp(r'^Map$'); .toSet() as ReturnType; } if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { - targetType = match![1]!; // ignore: parameter_assignments - return Map.fromIterables( - value.keys, + targetType = match![1]!.trim(); // ignore: parameter_assignments + return Map.fromIterables( + value.keys as Iterable, value.values.map((dynamic v) => deserialize(v, targetType, growable: growable)), ) as ReturnType; } break; - } + } throw Exception('Cannot deserialize'); } \ No newline at end of file