在模板 dom 中使用计算 属性 重复似乎并没有真正获取数据

using a computed property in a template dom repeat seems to not actually get data

我一直在使用的用例是我有一些标记如下。

<my-radiolist value="{{myValue}}">
  <template is="dom-repeat" items="{{test}}">
    <my-radiobutton value="{{item}}" label="{{item}}"></my-radiobutton>
  </template>
</my-radiolist>

当测试定义为:

@property List<int> test = [1,2,3];

它工作得很好。

现在,我想通过遍历一个更复杂的对象来填充这个列表。我想让它计算出来,然后执行给定的函数。我将样本更新如下:

@Property(computed:"getTest()")
List<Map> test = null;

@reflectable
List<Map> getTest() {
  print("Inside my getTest Function");
  return [{"key": "test", "value": "test"}, {"key":"test 2","value":"test 2"}];
}

我注意到我的打印语句从未触发,所以我的 属性 有我的默认值,这意味着没有什么可以迭代的。

我以前做过这些,但不是模板重复器。我做错了什么吗?

我的想法是,由于在更新参数时会更新计算,并且由于我没有使用任何参数,因此在这种情况下使用计算 属性 不是我应该采取的行动。

The value is interpreted as a method name and argument list. The method is invoked to calculate the value whenever any of the argument values changes. Computed properties should never be written to directly. See Computed properties for more information.

如果没有参数,那么在我看来计算 属性 无论如何在这里都没有意义。

另见 https://github.com/dart-lang/polymer-dart/wiki/properties#computed-properties