Dart IronResponse调用了一个JsObjectImpl对象,但我在上面找不到类文档

Dart IronResponse调用了一个JsObjectImpl对象,但我在上面找不到类文档,dart,polymer,dart-polymer,Dart,Polymer,Dart Polymer,我试图解析IronAjax成功处理程序的返回,并将响应设置为Map实例。似乎不是这样 我的HTML标记是: <iron-ajax id="myAjaxId" auto url="http://localhost:12345/test_server/v1/daily" handle-as="json" on-response="handleResponse" on-error="handleError"></iron-ajax> 我不确定是否需要在其上运行co

我试图解析IronAjax成功处理程序的返回,并将响应设置为Map实例。似乎不是这样

我的HTML标记是:

<iron-ajax id="myAjaxId" auto
  url="http://localhost:12345/test_server/v1/daily"
  handle-as="json"
  on-response="handleResponse" on-error="handleError"></iron-ajax>
我不确定是否需要在其上运行convert,即使IronAjax设置的返回类型是json

因此,由于
ir.response
将被设置或为null,我首先检查它是否为null。
responseHandler
中的
var数据
行当前设置为,但我也尝试了如下操作:
Map data=new Map.from(ir.response)也会失败

尽管这被称为JSON处理,并返回一个jslint确认的objected,但将其转换为适当的映射实例似乎存在问题

根据以下要求:
它说responseis*,解析的响应体。我是否搞错了如何正确设置,或者我是否遗漏了什么?

您可以尝试在属性上使用Object而不是map,然后使用
convertToDart
。不确定这是否会产生一张地图,但我想值得一试。另请参见

您可以尝试使用
对象
而不是属性上的映射,然后使用
convertToDart
。不确定这是否会产生一个
映射
,但我想值得一试。另请参见:convertToDart做什么?我想在itI上找到文档,但我不知道文档。我认为这应该是一个偶尔泄露的实现细节。这可能需要在Dart IronAjax中进行修复。我已经完成了转换,现在可以工作了!:)<代码>列表行=转换开始(数据[“数据”])??[]; 列表头=行[0].keys.map((m)=>{m:${camelToFormal(m)}}).toList()现在完全按照预期执行。感谢您的帮助JSObjectImpl意味着您在JavaScript对象周围有了一个包装器。JS并没有真正的地图,它只有带键的对象。所以Todart给出了省道图。
void handleResponse(CustomEventWrapper cew, IronRequest ir){
  print("inside handleResponse");
  var data =  ir.response;       // <-- is type JsObjectImpl
  print("data");
  print(data);
  if (data == null) return;

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

  print("Variables are Set locally");

  $['myDatagrid'].render();
}

@reflectable
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;
}
@reflectable
void handleError(CustomEventWrapper cew, IronRequest ir){
  print("____Error:____");
  print(ir.response);
}
type 'JsObjectImpl' is not a subtype of type 'Map' of 'other'.