gpt4 book ai didi

dart - 两个@published属性是否可以具有相同的名称

转载 作者:行者123 更新时间:2023-12-03 03:44:17 25 4
gpt4 key购买 nike

我有两个组成部分,如下所示:
。镖

@CustomTag('a-component')
class AComponent extends PolymerElement {

@published
String get descriptionLabel => readValue(#descriptionLabel);
set descriptionLabel(String value) => writeValue(#descriptionLabel, value);
}

@CustomTag('b-component')
class BComponent extends PolymerElement {

@published
String get descriptionLabel => readValue(#descriptionLabel);
set descriptionLabel(String value) => writeValue(#descriptionLabel, value);
}
这些@publish属性是按实例显示的,还是放在Dart框架中的 map 中,它们在访问时表示相同的属性?

最佳答案

当然,您可以在不同的组件中使用相同的名称发布属性。在一个组件中,名称当然必须是唯一的,但是无论如何,这都是由Dart分析器和Dart运行时检查的,您会立即收到错误消息。

关于dart - 两个@published属性是否可以具有相同的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30792590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com