override property

dynamic override

A list of library names or "*".

When used as metadata on an import of "dart:mirrors", this metadata does not apply to the library in which the annotation is used, but instead applies to the other libraries (all libraries if "*" is used).

The following text is non-normative:

Dart2js currently supports the following formats to specify libraries:

  • A constant List containing String constants representing names of libraries.
  • A single String constant whose value is a comma-separated list of library names.

Conceptually, a MirrorsUsed annotation with override has the same effect as placing the annotation directly on the import of dart:mirrors in each of the referenced libraries. Thus, if the library had no MirrorsUsed annotation before, its unconditional import of dart:mirrors is overridden by an annotated import.

Note that, like multiple explicit MirrorsUsed annotations, using override on a library with an existing MirrorsUsed annotation is additive. That is, the overall set of reflective targets is the union of the reflective targets that arise from the original and the overriding MirrorsUsed annotations.

The use of override is only meaningful for libraries that have an import of dart:mirrors without annotation because otherwise it would work exactly the same way without the override parameter.

While the annotation will apply to the given target libraries, the symbols, targets and metaTargets are still evaluated in the scope of the annotation. Thus, to select a target from library foo, a qualified name has to be used or, if the target is visible in the current scope, its type may be referenced.

For example, the following code marks all targets in the library foo as reflectable that have a metadata annotation using the Reflectable class from the same library.

@MirrorsUsed(metaTargets: "foo.Reflectable", override: "foo")

However, the following code would require the use of the Reflectable class from the current library, instead.

@MirrorsUsed(metaTargets: "Reflectable", override: "foo")


final override