dev_compiler
dev_compiler copied to clipboard
Passing a Dart Type to interop lends a `WrappedType` instead of the real class
Any reference to a dart type like in :
var x = MyTag
gets translated in
let x = dart.wrapType(index.MyTag);
So when passing a type to an interop call like in new JsObject.fromBrowserObject(h.document).callMethod("registerElement",['my-tag', x]); the native call receives a WrappedType instead of the actual Dart translated JS class.
Trying to "jsify" in the hope that the type will get unrwapped will ends up in an exception.
There should be a way to pass the actual class to native calls.
@jacob314 -- should JS interop to provide some way to go from a Type to the corresponding JS constructor function? It seems like it, IMO.
@dam0vm3nt -- a workaround for now is to call dart.unwrapType(x) from JS.