toJsonBody method
Implementation
String toJsonBody(String className) {
return checkNestedTypes(type!, (String cleanedType, bool isList, bool isListInList, bool isModel) {
String conversion;
if (isListInList) {
conversion = '$name$isNullableString.map((e) => e.map((e) => e.toJson()).toList()).toList()';
} else if (isList) {
if (isModel) {
conversion = '$name$isNullableString.map((e) => e.toJson()).toList()';
} else {
conversion = '$name$isNullableString.map((e) => e.toString()).toList()';
}
} else if (isModel) {
conversion = '$name$isNullableString.toJson()';
} else if (isDatetime) {
conversion = '$name$isNullableString.toIso8601String()';
} else {
conversion = '$name';
}
return '\'$name\': $conversion';
});
}