felix 1 жил өмнө
parent
commit
e7e5dee38e

+ 3 - 4
ModelTypes/ComplexModelType.cs

@@ -27,6 +27,7 @@ namespace FlutterCodeGenerator.ModelTypes
                 }
                 else if (child is EnumNullableModelType)
                 {
+                    source.AppendLine($"\t\tif ({child.Name_Lower} != null)");
                     source.AppendLine($"\t\tmap['{child.Name_Upper}'] = {child.Name_Lower}?.index;");
                 }
                 else if (child.DefaultValue != null)
@@ -35,15 +36,13 @@ namespace FlutterCodeGenerator.ModelTypes
                 }
                 else if (child is DateTimeModelType)
                 {
-                    source.AppendLine($"\t\tif ({child.Name_Lower} != null) {{");
+                    source.AppendLine($"\t\tif ({child.Name_Lower} != null)");
                     source.AppendLine($"\t\t\tmap['{child.Name_Upper}'] = JsonRpcUtils.dateFormat({child.Name_Lower}!);");
-                    source.AppendLine($"\t\t}}");
                 }
                 else
                 {
-                    source.AppendLine($"\t\tif ({child.Name_Lower} != null) {{");
+                    source.AppendLine($"\t\tif ({child.Name_Lower} != null)");
                     source.AppendLine($"\t\t\tmap['{child.Name_Upper}'] = {child.Name_Lower};");
-                    source.AppendLine($"\t\t}}");
                 }
             }
             source.AppendLine("\t\treturn map;");

+ 1 - 0
ModelTypes/UserDefinedDerivedModelType.cs

@@ -189,6 +189,7 @@ namespace FlutterCodeGenerator.ModelTypes
                         }
                         else if (child is EnumNullableModelType)
                         {
+                            source.AppendLine($"\t\tif ({child.Name_Lower} != null)");
                             source.AppendLine($"\t\tmap['{child.Name_Upper}'] = {child.Name_Lower}?.index;");
                         }
                         else if (child.DefaultValue != null)