I am looking for some reverse of new JsObject.jsify. Something, that would convert javascript Object back to Dart Map Is there somethi
If you want to do it deeply and handle also other cases then simple maps AND preserve functions (unlike the json solution) then use this simple function:
_toDartSimpleObject(thing) {
if (thing is js.JsArray) {
List res = new List();
js.JsArray a = thing as js.JsArray;
a.forEach((otherthing) {
res.add(_toDartSimpleObject(otherthing));
});
return res;
} else if (thing is js.JsObject) {
Map res = new Map();
js.JsObject o = thing as js.JsObject;
Iterable k = js.context['Object'].callMethod('keys', [o]);
k.forEach((String k) {
res[k] = _toDartSimpleObject(o[k]);
});
return res;
} else {
return thing;
}
}