chrisbu / dartwatch-JsonObject

JsonObject which allows dot notation access to JSON.parse'd objects. Read the article on http://www.dartlang.org/articles/json-web-service/
http://www.dartlang.org/articles/json-web-service/
MIT License
83 stars 25 forks source link

dart2js and complex json Uncaught Error: NoSuchMethodError #24

Closed marcog83 closed 11 years ago

marcog83 commented 11 years ago

Hi, I tried to port angularjs tutorial "phonecat". Running the project in Dartium works, but when I compile it to JS, it breaks.


var phone = new JsonObject.fromJsonString(response);

// i can see it
print("${phone}");

// it breaks :(
print("${phone.images}");

When I convert json text response to JsonObject an error occurs.


--- 24-apr-2013 12.54.59 Compiling /WebUI_Demo/web/example.dart... ---
Using snapshot "C:\dart\dart-sdk\bin\snapshots\utils_wrapper.dart.snapshot"
Uncaught Error: NoSuchMethodError : method not found: ''
Receiver: null
Arguments: []
Stack Trace:
TypeError: Cannot call method 'forEach$1' of undefined
    at $._symbolMapToStringMap (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:5427:7)
    at JsonObject.$$.Object.noSuchMethod$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:3557:123)
    at JsonObject.$$.JsonObject.noSuchMethod$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:4266:39)
    at JsonObject.eval [as get$images] (eval at  (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:7688:34), :2:13)
    at main_anon.$$.main_anon.call$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:18:89)
    at _ThenFuture.$$._ThenFuture._onValue$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:2109:26)
    at _ThenFuture.$$._ThenFuture._sendValue$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:2115:21)
    at _ThenFuture.$$._FutureImpl._setValue$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:1960:17)
    at _ThenFuture.$$._FutureImpl._setOrChainValue$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:2032:12)
    at _ThenFuture.$$._ThenFuture._sendValue$1 (http://127.0.0.1:3030/C:/Workspaces/Dart/2013/WebUI%20Demo/WebUI_Demo/web/example.dart.js:2124:10)

the json file I used is https://github.com/angular/angular-phonecat/blob/master/app/phones/motorola-xoom-with-wi-fi.json

Thanks a lot marco

chrisbu commented 11 years ago

Thanks for the bug report - I'll take a look over the weekend.