JavaScript Interop Automation in Dart

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

I tried first to find a command line interface that parses the JavaScript library so that I can automatically generate the Darth source code. I was not successful in the search.

+5
source share
2 answers

Introspection of JS lib can be very complex due to the dynamic edge 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 these files are written manually.

At the moment, such a tool is not yet available.

+2
source

I tried to execute my implementation of .d.ts -> dart2js annotation converter.

This is a possible way to automate the process.

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

+3
source

All Articles