Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast问题处理 #41

Open
duoduoxi opened this issue Oct 20, 2020 · 0 comments

Comments

@duoduoxi
Copy link

希望作者有时间能处理下

"relist":"$[]Zdata",

上面的代码生成下面的代码

..relist = (json['relist'] as List) ?.map((e) => e == null ? null : Zdata.fromJson(e as Map<String, dynamic>)) ?.toList()

报错:
type 'String' is not a subtype of type 'Map<String, dynamic>' in type cast

把生成的代码改成:

..relist = (json['relist'] as List) ?.map((e) => e == null ? null : Zdata.fromJson(jsonDecode(e) as Map<String, dynamic>)) ?.toList()

问题解决。

感谢提供好工具

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant