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 .
I am curious how convert javascript library to dart file in the example .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 weled. Thanks
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/guides/web-programming.
I am curious how convert javascript library to dart file in the example https://github./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 weled. Thanks
Share Improve this question asked Jul 1, 2018 at 3:31 BAEBAE 9,00623 gold badges98 silver badges182 bronze badges1 Answer
Reset to default 9There is no way to convert JavaScript to Dart automatically.
package:js
allows you to call JavaScript from Dart in Dart browser apps.