Context

The Flutter framework frequently tweaks its render tree to optimize the paint
operations that are ultimately made per frame. In the web, these render tree
changes often result in DOM operations.

Flutter web used to render its platform views (HtmlElementView widgets)
directly into its corresponding position of the DOM.

Using certain DOM elements as the “target” of some DOM operations causes those
elements to lose their internal state. In practice, this means that iframe
tags are going to reload, video players might restart, or an editable form
might lose its edits.

Flutter now renders platform views using slot elements inside of a single,
app-wide shadow root. Slot elements can be added/removed/moved around the
Shadow DOM without affecting the underlying slotted content (which is rendered
in a constant location)

This change was made to:

Stabilize the behavior of platform views in Flutter web.