portMapping property

List<WebviewPortMapping>? get portMapping

Mappings of localhost ports used inside the webview.

Port mapping allow webviews to transparently define how localhost ports are resolved. This can be used to allow using a static localhost port inside the webview that is resolved to random port that a service is running on.

If a webview accesses localhost content, we recommend that you specify port mappings even if the webviewPort and extensionHostPort ports are the same.

Note that port mappings only work for http or https urls. Websocket urls (e.g. ws://localhost:3000) cannot be mapped to another port.

Implementation

_i2.List<_i3.WebviewPortMapping>? get portMapping => (_i5.getProperty(
      this,
      'portMapping',
    ) as _i2.List?)
        ?.cast();