|
@@ -104,6 +104,7 @@ namespace FlutterCodeGenerator
|
|
|
public VoidModelType(string name) : base(typeof(void), name)
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
public override string GetFlutterTypeName(bool isDefault = true, bool isGenericName = false, bool isSingle = false)
|
|
|
{
|
|
|
return "void";
|
|
@@ -604,19 +605,26 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
}
|
|
|
dartString.AppendLine();
|
|
|
- dartString.AppendLine($"\t{GetFlutterTypeName()}({{");
|
|
|
- foreach (var child in Children)
|
|
|
+ if (Children.Count == 0)
|
|
|
{
|
|
|
- if (child.DefaultValue != null)
|
|
|
- {
|
|
|
- dartString.AppendLine($"\t\tthis.{child.Name_Lower} = {child.DefaultValue},");
|
|
|
- }
|
|
|
- else
|
|
|
+ dartString.AppendLine($"\t{GetFlutterTypeName()}();");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t{GetFlutterTypeName()}({{");
|
|
|
+ foreach (var child in Children)
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\tthis.{child.Name_Lower},");
|
|
|
+ if (child.DefaultValue != null)
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t\tthis.{child.Name_Lower} = {child.DefaultValue},");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t\tthis.{child.Name_Lower},");
|
|
|
+ }
|
|
|
}
|
|
|
+ dartString.AppendLine("\t});");
|
|
|
}
|
|
|
- dartString.AppendLine("\t});");
|
|
|
dartString.AppendLine();
|
|
|
|
|
|
dartString.Append(FromJson(Children));
|
|
@@ -686,34 +694,65 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
}
|
|
|
dartString.AppendLine();
|
|
|
- dartString.AppendLine($"\t{GetFlutterTypeName()}({{");
|
|
|
- foreach (var child in Children)
|
|
|
+ if (Children.Count == 0)
|
|
|
{
|
|
|
+ dartString.AppendLine($"\t{GetFlutterTypeName()}(");
|
|
|
if (baseType != null)
|
|
|
{
|
|
|
- if (baseType.Children.Any(x => x.ParameterType == child.ParameterType && x.Name_Upper == child.Name_Upper))
|
|
|
+ dartString.AppendLine($"\t) : super(");
|
|
|
+ foreach (var child in baseType.Children)
|
|
|
{
|
|
|
- var questionMark = QuestionMarkCheck(child);
|
|
|
- if (child.DefaultValue != null)
|
|
|
+ dartString.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower},");
|
|
|
+ }
|
|
|
+ dartString.AppendLine($"\t\t);");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dartString.AppendLine("\t);");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t{GetFlutterTypeName()}({{");
|
|
|
+ foreach (var child in Children)
|
|
|
+ {
|
|
|
+ if (baseType != null)
|
|
|
+ {
|
|
|
+ if (baseType.Children.Any(x => x.ParameterType == child.ParameterType && x.Name_Upper == child.Name_Upper))
|
|
|
{
|
|
|
- if (child is ListModelType || child is DictionaryModelType || child is UserDefinedGenericModelType)
|
|
|
+ var questionMark = QuestionMarkCheck(child);
|
|
|
+ if (child.DefaultValue != null)
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\t{child.GetFlutterTypeName(false, false)}{questionMark} {child.Name_Lower} = {child.DefaultValue},");
|
|
|
+ if (child is ListModelType || child is DictionaryModelType || child is UserDefinedGenericModelType)
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t\t{child.GetFlutterTypeName(false, false)}{questionMark} {child.Name_Lower} = {child.DefaultValue},");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t\t{child.GetFlutterTypeName()}{questionMark} {child.Name_Lower} = {child.DefaultValue},");
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\t{child.GetFlutterTypeName()}{questionMark} {child.Name_Lower} = {child.DefaultValue},");
|
|
|
+ if (child is ListModelType || child is DictionaryModelType || child is UserDefinedGenericModelType)
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t\t{child.GetFlutterTypeName(false, false)}{questionMark} {child.Name_Lower},");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dartString.AppendLine($"\t\t{child.GetFlutterTypeName()}{questionMark} {child.Name_Lower},");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (child is ListModelType || child is DictionaryModelType || child is UserDefinedGenericModelType)
|
|
|
+ if (child.DefaultValue != null)
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\t{child.GetFlutterTypeName(false, false)}{questionMark} {child.Name_Lower},");
|
|
|
+ dartString.AppendLine($"\t\tthis.{child.Name_Lower} = {child.DefaultValue},");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\t{child.GetFlutterTypeName()}{questionMark} {child.Name_Lower},");
|
|
|
+ dartString.AppendLine($"\t\tthis.{child.Name_Lower},");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -729,30 +768,19 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ if (baseType != null)
|
|
|
{
|
|
|
- if (child.DefaultValue != null)
|
|
|
+ dartString.AppendLine($"\t}}) : super(");
|
|
|
+ foreach (var child in baseType.Children)
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\tthis.{child.Name_Lower} = {child.DefaultValue},");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dartString.AppendLine($"\t\tthis.{child.Name_Lower},");
|
|
|
+ dartString.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower},");
|
|
|
}
|
|
|
+ dartString.AppendLine($"\t\t);");
|
|
|
}
|
|
|
- }
|
|
|
- if (baseType != null)
|
|
|
- {
|
|
|
- dartString.AppendLine($"\t}}) : super(");
|
|
|
- foreach (var child in baseType.Children)
|
|
|
+ else
|
|
|
{
|
|
|
- dartString.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower},");
|
|
|
+ dartString.AppendLine("\t});");
|
|
|
}
|
|
|
- dartString.AppendLine($"\t\t);");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dartString.AppendLine("\t});");
|
|
|
}
|
|
|
|
|
|
dartString.AppendLine();
|