Browse Source

尝试修复Dictionary复杂类FromJson类

felix 8 months ago
parent
commit
2ce6073c63
1 changed files with 2 additions and 3 deletions
  1. 2 3
      ModelTypes/ComplexModelType.cs

+ 2 - 3
ModelTypes/ComplexModelType.cs

@@ -146,9 +146,8 @@ namespace FlutterCodeGenerator.ModelTypes
                     else
                     {
                         source.AppendLine($"\t\tfinal {child.Name_Lower}Map= <{argumentName1},{argumentName2}>{{}};");
-                        source.AppendLine($"\t\tfinal Map<{argumentName1}, dynamic> json{child.Name_Lower}Map = jsonDecode(map['{child.Name_Upper}']);");
-                        source.AppendLine($"\t\tfor (var key in json{child.Name_Lower}Map.keys) {{");
-                        source.AppendLine($"\t\t\t{child.Name_Lower}Map[key] = {argumentName2}.fromJson(json{child.Name_Lower}Map[key]);");
+                        source.AppendLine($"\t\tfor (var key in map['{child.Name_Upper}'].keys) {{");
+                        source.AppendLine($"\t\t\t{child.Name_Lower}Map[key] = {argumentName2}.fromJson(map['{child.Name_Upper}'][key]);");
                         source.AppendLine($"\t\t}}");
                     }
                 }