void scopeSubtree(Element container, bool shouldObserve)

Apply style scoping to the specified container and all its descendants. If shoudlObserve is true, changes to the container are monitored via mutation observer and scoping is applied.

This method is useful for ensuring proper local DOM CSS scoping for elements created in this local DOM scope, but out of the control of this element (i.e., by a 3rd-party library) when running in non-native Shadow DOM environments.

Source

void scopeSubtree(Element container, bool shouldObserve) {
  jsElement.callMethod('scopeSubtree', [container, shouldObserve]);
}