Browse Source

支持string[]

felix 1 year ago
parent
commit
e028c3f0eb
3 changed files with 9 additions and 0 deletions
  1. BIN
      FISLib.dll
  2. 4 0
      ModelTypes/ComplexModelType.cs
  3. 5 0
      ModelTypes/ExtraObjectModelType.cs

BIN
FISLib.dll


+ 4 - 0
ModelTypes/ComplexModelType.cs

@@ -142,6 +142,10 @@ namespace FlutterCodeGenerator.ModelTypes
                     {
                         source.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower}Data != null ? ({child.Name_Lower}Data as List).map((e) => e as {child.ParameterType.Name.Replace("[]", string.Empty)}).toList(): null,");
                     }
+                    else if (modelType is SimpleModelType)
+                    {
+                        source.AppendLine($"\t\t\t{child.Name_Lower}:  map['{child.Name_Lower}']?.cast<{child.ParameterType.Name.Replace("[]", string.Empty)}>().toList(),");
+                    }
                     else
                     {
                         source.AppendLine($"\t\t\t{child.Name_Lower}: {child.Name_Lower}Data != null ? ({child.Name_Lower}Data as List).map((e) => {child.ParameterType.Name.Replace("[]", string.Empty)}.fromJson(e)).toList(): null,");

+ 5 - 0
ModelTypes/ExtraObjectModelType.cs

@@ -4,6 +4,11 @@ namespace FlutterCodeGenerator.ModelTypes
 {
     internal class ExtraObjectModelType : SimpleModelType
     {
+        /// <summary>
+        /// 用于嵌套中的类
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="name"></param>
         public ExtraObjectModelType(Type type, string name) : base(type, name)
         {
         }