metadata property Null safety

List<Object> metadata

A list of the metadata associated with this declaration.

Let D be the declaration this mirror reflects. If D is decorated with annotations A1, ..., An where n > 0, then for each annotation Ai associated with D, 1 <= i <= n, let ci be the constant object specified by Ai. Then this method returns a list whose members c1, ..., cn. If no annotations are associated with D, then an empty list is returned.

If evaluating any of c1, ..., cn would cause a compilation error the effect is the same as if a non-reflective compilation error had been encountered.

Note that the return type of the corresponding method in dart:mirrors is List.

Required capabilities: metadata requires a MetadataCapability.


// TODO(eernst) doc: Make this comment more user friendly.
// TODO(eernst) implement: Include comments as `metadata`, remember to
// indicate which ones are doc comments (`isDocComment`),
// cf.
// Note that we may wish to represent a comment as an
// instance of [Comment] from reflectable/mirrors.dart,
// which is required in order to indicate explicitly that it is
// a doc comment; or we may decide that this violation of the
// "return a base object, not a mirror" rule is unacceptable, and
// return a [String], thus requiring the receiver to determine
// whether or not it is a doc comment, based on the contents
// of the [String].
// Remark from sigurdm@ on this topic, 2015/03/19 09:50:06: We
// could also consider extending the interface with a
// `docComments` or similar.  To me it is highly confusing that
// metadata returns comments.  But if dart:mirrors does this we
// might just want to follow along.
/// Required capabilities: [metadata] requires a [MetadataCapability].
List<Object> get metadata;