meta library
Constants for use in metadata annotations.
See also @deprecated
and @override
in the dart:core
library.
Annotations provide semantic information that tools can use to provide a
better user experience. For example, an IDE might not autocomplete the name
of a function that's been marked @deprecated
, or it might display the
function's name differently.
For information on installing and importing this library, see the
meta package on pub.dartlang.org
(http://pub.dartlang.org/packages/meta).
For examples of using annotations, see
Metadata
in the language tour.
Classes
Constants
- alwaysThrows → const _AlwaysThrows
-
Used to annotate a function
f
. Indicates thatf
always throws an exception. Any functions that overridef
, in class inheritence, are also expected to conform to this contract. [...]const _AlwaysThrows()
- checked → const _Checked
-
Used to annotate a parameter of an instance method that overrides another
method. [...]
const _Checked()
- experimental → const _Experimental
-
Used to annotate a library, or any declaration that is part of the public
interface of a library (such as top-level members, class members, and
function parameters) to indicate that the annotated API is experimental and
may be removed or changed at any-time without updating the version of the
containing package, despite the fact that it would otherwise be a breaking
change. [...]
const _Experimental()
- factory → const _Factory
-
Used to annotate an instance or static method
m
. Indicates thatm
must either be abstract or must return a newly allocated object ornull
. In addition, every method that either implements or overridesm
is implicitly annotated with this same annotation. [...]const _Factory()
- immutable → const Immutable
-
Used to annotate a class
C
. Indicates thatC
and all subtypes ofC
must be immutable. [...]const Immutable()
- isTest → const _IsTest
-
Used to annotate a test framework function that runs a single test. [...]
const _IsTest()
- isTestGroup → const _IsTestGroup
-
Used to annotate a test framework function that runs a group of tests. [...]
const _IsTestGroup()
- literal → const _Literal
-
Used to annotate a const constructor
c
. Indicates that any invocation of the constructor must use the keywordconst
unless one or more of the arguments to the constructor is not a compile-time constant. [...]const _Literal()
- mustCallSuper → const _MustCallSuper
-
Used to annotate an instance method
m
. Indicates that every invocation of a method that overridesm
must also invokem
. In addition, every method that overridesm
is implicitly annotated with this same annotation. [...]const _MustCallSuper()
- optionalTypeArgs → const _OptionalTypeArgs
-
Used to annotate a class declaration
C
. Indicates that any type arguments declared onC
are to be treated as optional. Tools such as the analyzer and linter can use this information to suppress warnings that would otherwise require type arguments to be provided for instances ofC
.const _OptionalTypeArgs()
- protected → const _Protected
-
Used to annotate an instance member (method, getter, setter, operator, or
field)
m
in a classC
. If the annotation is on a field it applies to the getter, and setter if appropriate, that are induced by the field. Indicates thatm
should only be invoked from instance methods ofC
or classes that extend, implement or mix inC
, either directly or indirectly. Additionally indicates thatm
should only be invoked onthis
, whether explicitly or implicitly. [...]const _Protected()
- required → const Required
-
Used to annotate a named parameter
p
in a method or functionf
. Indicates that every invocation off
must include an argument corresponding top
, despite the fact thatp
would otherwise be an optional parameter. [...]const Required()
- virtual → const _Virtual
-
Used to annotate a field that is allowed to be overridden in Strong Mode.
const _Virtual()
- visibleForOverriding → const _VisibleForOverriding
-
Used to annotate an instance member that was made public so that it could be
overridden but that is not intended to be referenced from outside the
defining library. [...]
const _VisibleForOverriding()
- visibleForTesting → const _VisibleForTesting
-
Used to annotate a declaration was made public, so that it is more visible
than otherwise necessary, to make code testable. [...]
const _VisibleForTesting()