Dart Web UI - 将对象数据传递到组件 [英] Dart Web UI - Passing object data to a component
问题描述
我尝试将数据传递给自定义组件。
示例:http://www.dartlang .org / articles / web-ui /#pass-data-to-component 效果不错。
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.
但我想传递一个JsonObject var,它与此消息崩溃:
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?
推荐答案
这适用于我传递Map类时。也许您可以更改代码以使用 dart:json 库和核心库Map类,而不是第三方 JsonObject 。
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还使用了dart2js中尚不支持的库库,因此可能不适合基于浏览器的开发。
JsonObject also uses the mirrors library, which is not yet supported in dart2js, so may not be a good fit for browser based development.
这篇关于Dart Web UI - 将对象数据传递到组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!