JS class

The annotation for JS interop members.

This is meant to signify that a given library, top-level external member, or inline class is a JS interop declaration.

Specifying name customizes the JavaScript name to use. This can be used in the following scenarios:

  • Namespacing all the external top-level members, static members, and constructors of a library by annotating the library with a custom name.
  • Namespacing all the external static members and constructors of an inline class by annotating the inline class with a custom name.
  • Renaming external members by annotating the member with a custom name.

In the case where name is not specified, we default to the Dart name for inline classes and external members.

Note: package:js exports an @JS annotation as well. Unlike that annotation, this is meant for inline classes, and will result in more type-checking for external top-level members.

Constructors

JS([String? name])
const

Properties

hashCode int
The hash code for this object.
no setterinherited
name String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited