dart: how to get correct (typed) reference to document object in iframe


I have a use case where a complex UI hierarchy needs to be rendered in an iframe, but the logic handling it (creation, enter document, event handling, exit document) need to be in the main frame / app.

I face issues with getting a typed reference to the Document instance of the iframe. Is this possible at all? The code errors even with type casts.

Any advise would be helpful, except the one to use js interop – something as simple as extracting a UI branch and fitting it inside an iframe should not require this IMHO.

Also if this is not possible where should I go filling a bug?


Cross window access is very limited due to security concerns. There are open issues to allow it again because it can be circumvented by dart-js-interop anyway.

So the suggested solution is to use dart:js as workaround until the issues are fixed.

  var ifrm = new js.JsObject.fromBrowserObject(dom.querySelector('#ifrm'));

Answered By – Günter Zöchbauer

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *