protected top-level constant
Used to annotate an instance member in a class or mixin which is meant to be visible only within the declaring library, and to other instance members of the class or mixin, and their subtypes.
If the annotation is on a field it applies to the getter, and setter if appropriate, that are induced by the field.
Indicates that the annotated instance member (method, getter, setter,
operator, or field) m
in a class or mixin C
should only be referenced
in specific locations. A reference from within the library in which C
is
declared is valid. Additionally, a reference from within an instance member
in C
, or a class that extends, implements, or mixes in C
(either
directly or indirectly) or a mixin that uses C
as a superclass constraint
is valid. Additionally a reference from within an instance member in an
extension that applies to C
is valid.
Additionally restricts the instance of C
on which m
is referenced: a
reference to m
should either be in the same library in which C
is
declared, or should refer to this.m
(explicitly or implicitly), and not
m
on any other instance of C
.
Tools, such as the analyzer, can provide feedback if
- the annotation is associated with anything other than an instance member, or
- a reference to a member
m
which has this annotation, declared in a class or mixinC
, is found outside of the declaring library and outside of an instance member in any class that extends, implements, or mixes inC
or any mixin that usesC
as a superclass constraint, or - a reference to a member
m
which has this annotation, declared in a class or mixinC
, is found outside of the declaring library and the receiver is something other thanthis
.
Implementation
// TODO(srawlins): Add a sentence which defines "referencing" and explicitly
// mentions tearing off, here and on the other annotations which use the word
// "referenced."
const _Protected protected = _Protected();