Dart Web UI - Passing object data to a component

心已入冬 提交于 2019-12-11 03:15:16

问题


I am trying to pass data to custom component. The example at http://www.dartlang.org/articles/web-ui/#pass-data-to-component works good.

But I'm trying to pass a JsonObject var, and it crash with this message:

Exception: type 'String' is not a subtype of type 'JsonObject' of  'value'. 

So it seems like I can pass only strings and numbers data?


回答1:


This works for me when passing the Map class. Perhaps you could change your code to use the dart:json library and the core library Map class, rather than the third-party JsonObject.

JsonObject also uses the mirrors library, which is not yet supported in dart2js, so may not be a good fit for browser based development.



来源:https://stackoverflow.com/questions/15589757/dart-web-ui-passing-object-data-to-a-component

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!