Access Polymer inner element programmatically


I’m enclosing my app in a Polymer element and I want to use another polymer element inside it. To call all the method of the inner element I’m trying to use $[].
Insider the external polymer element I have this:

ImageEditor ime;
DivElement div2;
ImageTool.created(): super.created(){
  div2 = $["secondDiv"];
  ime = $["imageEditor1"]

In the Html I simply have:

<polymer-element name="da-imagetool">
<div class="images" id="mainDiv">
  <da-imageeditor id="imageEditor1" name="ied"></da-imageeditor>

with the script src at the end.
For some reason I get an exception when I assign the imageEditor1 to ime.

Exception: type ‘HtmlElement’ is not a subtype of type ‘ImageEditor’ of ‘value’.


It looks like the browser hasn’t upgraded the <da-imageeditor> elements.

Make sure that you <import> the <da-imageeditor> element, and have the correct @CustomTag annotation on the ImageEditor class declaration.

Answered By – Justin Fagnani

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

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