|
@@ -62,7 +62,7 @@ namespace FlutterCodeGenerator
|
|
|
var serviceModelDartString = new StringBuilder();
|
|
|
foreach (var importService in importServiceList)
|
|
|
{
|
|
|
- serviceModelDartString.AppendLine($"import '{LetterConverterHelper.FirstCharToLower(importService[0..^7]) }.m.dart';");
|
|
|
+ serviceModelDartString.AppendLine($"import '{LetterConverterHelper.FirstCharToLower(importService[0..^7])}.m.dart';");
|
|
|
}
|
|
|
if (importServiceList.Count > 0)
|
|
|
{
|
|
@@ -107,6 +107,69 @@ namespace FlutterCodeGenerator
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ var returnModelType = methodMap.ReturnParameterModelType;
|
|
|
+ if (returnModelType is ComplexModelType)
|
|
|
+ {
|
|
|
+ importService = CodeGenerator.AlreadyGeneratedList.FirstOrDefault(x => x.Key.ParameterType.Name == returnModelType.ParameterType.Name && x.Key.ParameterType.Namespace == returnModelType.ParameterType.Namespace).Value;
|
|
|
+ if (importService == null)
|
|
|
+ {
|
|
|
+ throw new Exception("Import Service is null");
|
|
|
+ }
|
|
|
+ if (importService != _serviceName && !importServiceList.Contains(importService))
|
|
|
+ {
|
|
|
+ importServiceList.Add(importService);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (returnModelType is ListModelType listModelType)
|
|
|
+ {
|
|
|
+ var subReturnType = listModelType.GenericArgumentModelType;
|
|
|
+ if (subReturnType is ComplexModelType)
|
|
|
+ {
|
|
|
+ importService = CodeGenerator.AlreadyGeneratedList.FirstOrDefault(x => x.Key.ParameterType.Name == subReturnType.ParameterType.Name && x.Key.ParameterType.Namespace == subReturnType.ParameterType.Namespace).Value;
|
|
|
+ if (importService == null)
|
|
|
+ {
|
|
|
+ throw new Exception("Import Service is null");
|
|
|
+ }
|
|
|
+ if (importService != _serviceName && !importServiceList.Contains(importService))
|
|
|
+ {
|
|
|
+ importServiceList.Add(importService);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (returnModelType is ArrayModelType arrayModelType)
|
|
|
+ {
|
|
|
+ var subReturnType = arrayModelType.Child;
|
|
|
+ if (subReturnType is ComplexModelType)
|
|
|
+ {
|
|
|
+ importService = CodeGenerator.AlreadyGeneratedList.FirstOrDefault(x => x.Key.ParameterType.Name == subReturnType.ParameterType.Name && x.Key.ParameterType.Namespace == subReturnType.ParameterType.Namespace).Value;
|
|
|
+ if (importService == null)
|
|
|
+ {
|
|
|
+ throw new Exception("Import Service is null");
|
|
|
+ }
|
|
|
+ if (importService != _serviceName && !importServiceList.Contains(importService))
|
|
|
+ {
|
|
|
+ importServiceList.Add(importService);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (returnModelType is DictionaryModelType dictionaryModelType)
|
|
|
+ {
|
|
|
+ foreach (var subReturnType in dictionaryModelType.GenericArgumentModelTypeList)
|
|
|
+ {
|
|
|
+ if (subReturnType is ComplexModelType)
|
|
|
+ {
|
|
|
+ importService = CodeGenerator.AlreadyGeneratedList.FirstOrDefault(x => x.Key.ParameterType.Name == subReturnType.ParameterType.Name && x.Key.ParameterType.Namespace == subReturnType.ParameterType.Namespace).Value;
|
|
|
+ if (importService == null)
|
|
|
+ {
|
|
|
+ throw new Exception("Import Service is null");
|
|
|
+ }
|
|
|
+ if (importService != _serviceName && !importServiceList.Contains(importService))
|
|
|
+ {
|
|
|
+ importServiceList.Add(importService);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
var complexReturnTypeNameList = GetUserDefinedComplexReturnTypeList();
|
|
@@ -134,7 +197,7 @@ namespace FlutterCodeGenerator
|
|
|
|
|
|
foreach (var importService in importServiceList)
|
|
|
{
|
|
|
- serviceDartString.AppendLine($"import '{LetterConverterHelper.FirstCharToLower(importService[0..^7]) }.m.dart';");
|
|
|
+ serviceDartString.AppendLine($"import '{LetterConverterHelper.FirstCharToLower(importService[0..^7])}.m.dart';");
|
|
|
}
|
|
|
if (importServiceList.Count > 0)
|
|
|
{
|