You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to switch from 'dart:html' to 'package:web/web.dart' and ran into a problem migrating IFrameElement to HTMLIFrameElement.
My use-case is to visualize HTML-Code in a Flutter Web-App.
The following code compiles, but runs into an error when opening the View: The following JSNoSuchMethodError was thrown building Builder(dirty):
TypeError: Illegal constructor
The line "web.HTMLIFrameElement iframeElement = web.HTMLIFrameElement()" seems to be the problem.
With "IFrameElement" (outcommented line) everything works fine.
These external constructors on Elements were accidentally emitted because the IDL exposes them for custom element support. They don't work as you would expect. I just landed #185 which should expose some constructors (and remove those other, incorrect constructors) that will make it easier to create these elements but that will be in the next version release.
For your package version, document.createElement is the right API here e.g. document.createElement('iframe') as HTMLIFrameElement. Use that to get an HTMLIFrameElement instead. Sorry for the confusion.
I am trying to switch from 'dart:html' to 'package:web/web.dart' and ran into a problem migrating IFrameElement to HTMLIFrameElement.
My use-case is to visualize HTML-Code in a Flutter Web-App.
The following code compiles, but runs into an error when opening the View:
The following JSNoSuchMethodError was thrown building Builder(dirty):
TypeError: Illegal constructor
The line "web.HTMLIFrameElement iframeElement = web.HTMLIFrameElement()" seems to be the problem.
With "IFrameElement" (outcommented line) everything works fine.
Versions:
Flutter 3.19.2 • channel stable
Dart 3.3.0 • DevTools 2.31.1
web 0.4.2 (web 0.5.0 incompatible with dependency constraints)
The text was updated successfully, but these errors were encountered: