Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert javascript to dart

I am reading To leverage one of the many existing libraries written in JavaScript, use package:js. If a TypeScript type definition file exists for a JavaScript library (see DefinitelyTyped for more info), you can use the js_facade_gen tool to generate Dart code for that library. from https://webdev.dartlang.org/guides/web-programming.

I am curious how convert javascript library to dart file in the example https://github.com/google/chartjs.dart. I guess there are two steps: 1, generate TypeScript type definition file (ts file) from the javascript library; 2, Use js_facade_gen to convert ts file to dart.

I hope get more details. but the document is lacking. Any hints welcomed. Thanks

like image 903
BAE Avatar asked Mar 05 '23 22:03

BAE


1 Answers

There is no way to convert JavaScript to Dart automatically.
package:js allows you to call JavaScript from Dart in Dart browser apps.

like image 51
Günter Zöchbauer Avatar answered Mar 11 '23 04:03

Günter Zöchbauer