description

# toExternalReference property

ExternalDartReference<T> get toExternalReference

An opaque reference to this value of type `T` which can be passed to JavaScript.

When compiling to JavaScript, a Dart object is a JavaScript object, and therefore this directly returns the Dart object. When compiling to Wasm, an internal Wasm function is used to convert the Dart object to an opaque JavaScript value. If this value is `null`, returns `null`.

A value of type ExternalDartReference should be treated as completely opaque. It can only be passed around as-is or converted back using ExternalDartReferenceToObject.toDartObject.

When this getter is called multiple times on the same Dart object, the underlying references in the resulting ExternalDartReferences are guaranteed to be equal. Therefore, `==` will always return true between such ExternalDartReferences. However, like JS types, `identical` between such values may return different results depending on the compiler.

## Implementation

    external ExternalDartReference<T> get toExternalReference;