symbols property Null safety

dynamic symbols
final

The list of strings passed to new Symbol, and symbols that might be passed to MirrorSystem.getName.

Combined with the names of targets, metaTargets and their members, this forms the complete list of strings passed to new Symbol, and symbols that might be passed to MirrorSystem.getName by the library to which this metadata applies.

The following text is non-normative:

Dart2js currently supports the following formats to specify symbols:

  • A constant List of String constants representing symbol names, e.g., const ['foo', 'bar'].
  • A single String constant whose value is a comma-separated list of symbol names, e.g., "foo, bar".

Specifying the symbols field turns off the following warnings emitted by dart2js:

  • Using "MirrorSystem.getName" may result in larger output.
  • Using "new Symbol" may result in larger output.

For example, if you're using noSuchMethod to interact with a database, extract all the possible column names and include them in this list. Similarly, if you're using noSuchMethod to interact with another language (JavaScript, for example) extract all the identifiers from the API you use and include them in this list.

Note that specifying a symbol only ensures that the symbol will be available under that name at runtime. It does not mark targets with that name as available for reflection. See targets and metaTargets for that purpose.

Implementation

final symbols;