protected top-level constant

_Protected const protected

Used to annotate an instance member (method, getter, setter, operator, or field) m in a class C. If the annotation is on a field it applies to the getter, and setter if appropriate, that are induced by the field. Indicates that m should only be invoked from instance methods of C or classes that extend, implement or mix in C, either directly or indirectly. Additionally indicates that m should only be invoked on this, whether explicitly or implicitly.

Tools, such as the analyzer, can provide feedback if

  • the annotation is associated with anything other than an instance member, or
  • an invocation of a member that has this annotation is used outside of an instance member defined on a class that extends or mixes in (or a mixin constrained to) the class in which the protected member is defined.
  • an invocation of a member that has this annotation is used within an instance method, but the receiver is something other than this.

Implementation

const _Protected protected = const _Protected()