Can two @published properties have the same name

69 views Asked by At

I have two components as follows:

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

Are these @publish properties present on a per instance basis or are they placed in a map within Dart framework where they represent the same property when accessed?

1

There are 1 answers

0
Günter Zöchbauer On BEST ANSWER

Sure you can have published properties with the same name in different components. In one component the names have to be unique of course, but this is checked by the Dart analyzer and Dart runtime anyway and you would get an error immediately.