首先需要执行platformViewRegistry:
ui.platformViewRegistry.registerViewFactory( 'hello-world-html', (int viewId) => IframeElement() ..width = '640' ..height = '360' ..src = 'https://www.youtube.com/embed/IyFZznAk69U' ..style.border = 'none');
看那个例子。在该示例中,导入了旧库(在19.09.19上),但是如果您在“
flutter”上更改“ flutter_web”,则它必须可以工作。
另外,您不仅可以使用“ IframeElement”,还可以使用常规html:
ui.platformViewRegistry.registerViewFactory("simple_div", (int viewId) { DivElement element = DivElement(); ... return element;


