W3cubDocs

/Dart 2

pragma class

A hint to tools.

Tools that work with Dart programs may accept hints to guide their behavior as pragma annotations on declarations. Each tool decides which hints it accepts, what they mean, and whether and how they apply to sub-parts of the annotated entity.

Tools that recognize pragma hints should pick a pragma prefix to identify the tool. They should recognize any hint with a name starting with their prefix followed by : as if it was intended for that tool. A hint with a prefix for another tool should be ignored (unless compatibility with that other tool is a goal).

A tool may recognize unprefixed names as well, if they would recognize that name with their own prefix in front.

If the hint can be parameterized, an extra options object can be added as well.

For example:

@pragma('Tool:pragma-name', [param1, param2, ...])
class Foo { }

@pragma('OtherTool:other-pragma')
void foo() { }

Here class Foo is annotated with a Tool specific pragma 'pragma-name' and function foo is annotated with a pragma 'other-pragma' specific to OtherTool.

Annotations

Constructors

pragma(String name, [ Object options ])
const
factory
Creates a hint named name with optional options.

Properties

nameString
final
The name of the hint. [...]
optionsObject
final
Optional extra data parameterizing the hint.
hashCodeint
read-only, inherited
The hash code for this object. [...]
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.

Methods

noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
inherited
Returns a string representation of this object.

Operators

operator ==(dynamic other) → bool
inherited
The equality operator. [...]

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-core/pragma-class.html