How to port a Javascript library to Dart for backend use?

33 Views Asked by At

I am working on a Dart web application that runs in browsers, but I also compile it into an exe to generate preview images using the same code. I need to utilize a JavaScript library that doesn't rely on the DOM. Since dart:js is not available for the cli/backend platform, I'm looking for effective methods to port this library to Dart.

I tried to import the JS lib using dart:js but I got this error (as expected): Error: Dart library 'dart:js' is not available on this platform.

Has anyone here gone through this process and can offer some guidance on the best practices for this kind of porting task? Or are there tools that might facilitate this conversion? Any help or pointers towards resources that could assist me with this would be greatly appreciated.

Ideally, I want to avoid porting the library myself, as it contains many files (and it's not future-proof), but there are no Dart library alternatives.

Thank you!

0

There are 0 best solutions below