Dart 文档不是WindowBase的成员

Dart 文档不是WindowBase的成员,dart,Dart,我正在更新旧代码,但此部分不起作用: IFrameElement iframe=query('#myframe iframe'); 窗口iframeW=iframe.contentWindow;//投射错误 var myframeDoc=iframeW.document; 我将Window更改为“WindowBase”: IFrameElement iframe=query('#myframe iframe'); WindowBase iframeW=iframe.contentWindow;

我正在更新旧代码,但此部分不起作用:

IFrameElement iframe=query('#myframe iframe');
窗口iframeW=iframe.contentWindow;//投射错误
var myframeDoc=iframeW.document;
我将
Window
更改为“WindowBase”:

IFrameElement iframe=query('#myframe iframe');
WindowBase iframeW=iframe.contentWindow;
var myframeDoc=iframeW.document;
但是
document
不是
WindowBase
的成员。 我想访问它以进行如下查询:

myframeDoc.query(#myId”);
使用javascript,解决方案可以工作:

var myframeDoc=document.querySelector('#myframe iframe').contentWindow.document;

iFrame和Windows的API略有不同,因此您必须使用
WindowBase
而不是
Window


您可以在API文档中看到
iframelement.contentWindow
的类型是
WindowBase
,您也应该在编辑器的弹出文档中看到它。

的确如此。我正在更新旧代码,我发现他的密码有了突破性的变化。我的新问题是文档不是WindowBase的成员。我需要像这样对dom进行查询:myframeDoc.query(“myid”)这是一个很好的问题。您可能需要更新此问题,以明确WindowBase缺少文档获取工具,因此值得一份错误报告。