JsonToDartClass icon indicating copy to clipboard operation
JsonToDartClass copied to clipboard

这个地方可能会抛

Open JamesKarl opened this issue 5 years ago • 0 comments

如果$valueGetter != null 但是$valueGetter也不是一个List,$valueGetter as List会抛异常的。应该改为:$valueGetter is List

KotlineDataClass.kt 的第64行。

修改前p.isListType() && !p.getGenericType().isPrimitiveType() -> { append("$valueGetter != null ? ($valueGetter as List).map((i) => ${p.getGenericType()}.fromJson(i)).toList() : null") }

修改后p.isListType() && !p.getGenericType().isPrimitiveType() -> { append("$valueGetter is List ? ($valueGetter as List).map((i) => ${p.getGenericType()}.fromJson(i)).toList() : null") }

JamesKarl avatar Nov 01 '19 03:11 JamesKarl