st_clair_clarke
st_clair_clarke

Reputation: 5715

Can two @published properties have the same name

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?

Upvotes: 1

Views: 31

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658077

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.

Upvotes: 1

Related Questions