3
votes

I try to use JavaScript library visjs.org in Dart. I prepared ‘adapter’ code according examples on Dart site pub.dartlang.org/packages/js and github.com/google/chartjs.dart/blob/master/lib/chartjs.dart.

Also according basic use case example from http://visjs.org I prepare client dart code.

While code compiles without any errors and warnings nothing happens in browser, expected to see graph-tree.

What I did wrong or miss to do?

https://gist.github.com/EdSv/e274a4d12ad3491c383fb4fe76ee671e

1
I guess the -1 is because of the javascript tag (the question doesn't make much sense to them if they don't know Dart) and maybe because the question should contain the essential parts necessary to diagnose the problem (code you linked to). - Günter Zöchbauer
Don't you get any error messages (browser console or IDE)? - Günter Zöchbauer
code compiles without any errors in IDE console, but sometimes (seldom) after some time in dubug mode in Webstorm appears exception: dart.js : Failed assertion in line 397 !p.isNamed is not true, ....Internal error Dart_invoke expects library argument 'target' to be loaded. - EdSv
I provided code, go by bottom hyperlink to gist.github - EdSv
In first attempt i used for dynamic parameter optionally named parameters, for me it was logical and reliable, but it doesn't work correct, it works, create property, but when in dart code converted to js using optioanal parameters leads to creating array property as expected, in native js code acceptance an array [] leads to creating map instead array. (of course it is not obligatory..). I checked it in chrome console. Using dynamic or generic one parameter resolve that issue. Question is closed, my comment just for help. - EdSv

1 Answers

0
votes

The attribute @anonymous is meant to be used when the object you're describing doesn't actually exist in the JS library you're binding, and is only used as a plain old data object. By adding it to all of your objects, my guess is that dart is never attempting to create anything from the visjs library.

Try removing the @anonymous from your Network class and see if that has an effect. You will likely also need to make these abstract classes as well.