Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 两个@published属性是否可以具有相同的名称_Dart_Dart Polymer - Fatal编程技术网

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

Dart 两个@published属性是否可以具有相同的名称,dart,dart-polymer,Dart,Dart Polymer,我有以下两个部分: 飞奔 这些@publish属性是按每个实例显示的,还是放在Dart框架内的映射中,在访问时它们表示相同的属性?确保可以在不同组件中使用相同名称发布属性。当然,在一个组件中,名称必须是唯一的,但是Dart分析器和Dart运行时会检查这一点,并且您会立即得到一个错误 @CustomTag('a-component') class AComponent extends PolymerElement { @published String get descriptionLa

我有以下两个部分:

飞奔
这些@publish属性是按每个实例显示的,还是放在Dart框架内的映射中,在访问时它们表示相同的属性?

确保可以在不同组件中使用相同名称发布属性。当然,在一个组件中,名称必须是唯一的,但是Dart分析器和Dart运行时会检查这一点,并且您会立即得到一个错误

@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);
}