getHostElement method

JSAny? getHostElement(
  1. int viewId
)

Returns the host element for viewId.

In the full-page mode, the host element is the <body> element of the page and the view is the one and only PlatformDispatcher.implicitView.

In the add-to-app mode, the host element is the value of hostElement provided when creating the view.

This is useful for plugins and apps to have a safe DOM Element where they can add their own custom HTML elements (for example: file inputs for the file_selector plugin).

Implementation

JSAny? getHostElement(int viewId) {
  return _viewManager.getHostElement(viewId) as JSAny?;
}