|
@@ -136,6 +136,22 @@ namespace FlutterCodeGenerator.ModelTypes
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else if (child is DictionaryModelType dictionaryModelType)
|
|
|
+ {
|
|
|
+ var argumentName1 = dictionaryModelType.GenericArgumentModelTypeList[0].GetFlutterTypeName();
|
|
|
+ var argumentName2 = dictionaryModelType.GenericArgumentModelTypeList[1].GetFlutterTypeName();
|
|
|
+ if (dictionaryModelType.GenericArgumentModelTypeList[0] is SimpleModelType && dictionaryModelType.GenericArgumentModelTypeList[1] is SimpleModelType)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ 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\t}}");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
source.AppendLine($"\t\treturn {flutterTypeName}( ");
|
|
|
foreach (var child in Children)
|
|
@@ -249,7 +265,7 @@ namespace FlutterCodeGenerator.ModelTypes
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- source.AppendLine($"\t\t\t{child.Name_Lower}: map['{child.Name_Upper}'] != null ? map['{child.Name_Upper}'] as Map<{argumentName1},{argumentName2}> : null,");
|
|
|
+ source.AppendLine($"\t\t\t {child.Name_Lower} : {child.Name_Lower}Map");
|
|
|
}
|
|
|
}
|
|
|
else if (child is UserDefinedGenericModelType userDefinedGenericModelType)
|