Skip to content

Commit 6e36935

Browse files
list的datetime支持
1 parent ed140e8 commit 6e36935

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/ruiyu/jsontodart/ClassGeneratorInfo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class HelperClassGeneratorInfo {
8080
"dynamic" -> "data.${name}.addAll(json['$getJsonName']);"
8181
"DateTime" ->
8282
if (filed.getValueByName<String>("format")?.isNotEmpty() == true) {
83-
"\n\t\tDateFormat format = new DateFormat(\"${filed.getValueByName<String>("format")}\");\n\t\t\t(json['$getJsonName'] as List).forEach((v) {\n\t\t\t\tif (v != null)\n\t\t\t\t\tdata.$name.add(format.parse(v.toString()));\n\t\t\t});".trimIndent()
83+
"\n\t\tDateFormat format = new DateFormat(\"${filed.getValueByName<String>("format")}\");\n\t\t\t\t(json['$getJsonName'] as List).forEach((v) {\n\t\t\t\t\tif (v != null)\n\t\t\t\t\t\tdata.$name.add(format.parse(v.toString()));\n\t\t\t\t});".trimIndent()
8484
} else {
8585
"(json['$getJsonName'] as List).forEach((v) {\n\t\t\tdata.$name.add(DateTime.parse(v));\n\t\t});".trimIndent()
8686
}

0 commit comments

Comments
 (0)