toTransferable method

Map<String, Object?> toTransferable()
inherited

Converts this receiver to a platform-agnostic transferable representation.

On VM: the returned Map contains a raw SendPort (auto-serialized by Isolate.spawn). On Web: the returned Map contains a raw MessagePort (must be in the postMessage transfer list).

The reconstructed receiver will always use the remote path, since the ChannelCore stays in the original context.

Implementation

Map<String, Object?> toTransferable() => {
      'port': packPort(remotePort),
      if (metricsId != null) 'metricsId': metricsId,
    };