飞镖 angular 组件 OptionGroup:LabelFunction

dart angular components OptionGroup:LabelFunction

我正在使用新的 material-tree 并希望将一系列自定义对象作为 OptionGroup 传递,这些对象包含一个标签 属性,我需要使用 LabelFunction 对其进行增强,但是,这个特定的 typedef 不接受任何值,并且只是期望输出一个字符串,我想,我需要一个例子或者可能是一个关于我的用法的完整性检查。 鉴于这个简单的 class:

class pulsar {
  String label = '';
  String id = '';

  pulsar();
}

我要创建:

final SelectionOptions pulsars = new SelectionOptions([
    new OptionGroup.withLabelFunction(
        [pulsar1, pulsar2, pulsar3],
        (T) => labeler(T)
]);
// This is the problem, since the typedef String LabelFunction()
// Does not accept parameters.
// I will want this to work...
String labeler(pulsar p) => "${p.id} : ${p.label}";

我想,我想知道我是否错过了这个 LabelFunction..

的要点

没关系,我选择了 ItemRenderer。