6

When using a third-party JavaScript library in my Dart project, I manually go through the library's documentation and iterate through its properties and methods to build the Dart code through a series of tedious context and callMethod calls. Has anyone figured out a way to automate this?

I tried to first find a command-line interface that introspects the JavaScript library so that I can auto-generate the Dart source code. I've been unsuccessful in my search.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Damon
  • 826
  • 1
  • 10
  • 25

2 Answers2

3

I've tried to make my implementation of .d.ts -> dart2js annotations converter.

This is possible way to automate the process.

Please, see https://github.com/denis-aes/DefinitelyTyped.dart

Denis Obydennykh
  • 320
  • 2
  • 12
2

Introspecting JS lib can be really hard due to the dynamic face of the JS language.

In the Typescript world there are *.d.ts files used to provide types to existing libraries. As far as I can tell most of those files are manually writen.

For now such a tool isn't yet available.

Alexandre Ardhuin
  • 71,959
  • 15
  • 151
  • 132