IronResponse calls an JsObjectImpl object, but I cant find class docs on it


I was trying to parse the return of an IronAjax success handler and set the response to an instance of Map. It seems to not like that.

My HTML Markup is:

<iron-ajax id="myAjaxId" auto
  on-response="handleResponse" on-error="handleError"></iron-ajax>

My Dart Code is:

void handleResponse(CustomEventWrapper cew, IronRequest ir){
  print("inside handleResponse");
  var data =  ir.response;       // <-- is type JsObjectImpl
  if (data == null) return;

  print ("About to set rows");
  List<Map> rows = data.containsKey("data") ? data["data"] : [];

  print("Variables are Set locally");


String camelToFormal (String input){
  String out;

  RegExp regex = new RegExp("([A-Z])");
  out = input[0].toUpperCase() + input.substring(1).replaceAllMapped(regex, (Match m) => " ${m[1]}");
  return out;
void handleError(CustomEventWrapper cew, IronRequest ir){

The Error I get is:

type 'JsObjectImpl' is not a subtype of type 'Map' of 'other'.

I wasnt sure if I need to run convert over it, even though the return type set by IronAjax was json

So, since ir.response will either be set or null, i check if it is null first. the var data line in responseHandler currently sets is, but i have also attempted to do something like: Map data = new Map.from(ir.response); which fails as well.

Even though this is said to be handled as JSON, and is returning a jslint confirmed objected, it seems to have issues to convert it to a proper map instance.

According to Polymer IronRequest at:
it says that responseis *, the parsed response body. Am I mistaken as to how this is properly set up, or am I missing something?


You could try Object instead of map on the property and then use convertToDart. Not sure this results in a Map but worth a try I guess. See also Polymer 1.0 – iron-list – selection

Answered By – Günter Zöchbauer

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

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