BAE
BAE

Reputation: 8956

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

Upvotes: 4

Views: 6922

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 658087

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

Upvotes: 9

Related Questions