Bring your own JavaScript to Dart

There’s a lot of JavaScript libraries. It’d be nice if you could use them seamlessly from Dart, while maintaining Dart’s developer-friendly ergonomics.

At the Dart Summit in April, Dan and I talked about our plans for the future of JavaScript interop: the hashtag-able #byojslBring Your Own JavaScript Library.

With the latest preview release of Dart 1.13 – 1.13.0-dev.7, you can now play with this feature.

Check out the example in the source code.

Nice, huh?

Creating the Dart interop libraries using @Js() annotations allows dart2js to create very efficient Javascript connections to the source library. The interop libraries also give the users of the interop library the developer experience you expect from Dart code: completions, warnings, errors, etc.

If you want to try it out

We’ll have proper documentation on the site when 1.13 is ready for release. In the mean time, we’d love feedback as we prepare for the final release.

Updates since initial publish