JavaScript interoperability
Integrate JavaScript code into your Dart web app.
Integrate JavaScript libraries and APIs into Dart web apps.
Overview
#The Dart web platform provides tools to call JavaScript from Dart and Dart from JavaScript, bringing the JavaScript ecosystem directly to Dart code.
Find getting-started resources, usage guides, and dart:js_interop library
documentation for calling JavaScript libraries, interacting with browser APIs,
and compiling web apps to WebAssembly (Wasm).
Get started with JS interop:
Review the reference guides:
Interact with the browser:
WebAssembly (dart2wasm) support
#
When compiling Dart web apps to WebAssembly (dart compile wasm),
keep these interoperability and performance practices in mind:
-
Use
dart:js_interopandpackage:web: Deprecated legacy web and interop libraries (dart:html,dart:js,dart:js_util, andpackage:js) are unsupported on Wasm targets. - Minimize high-frequency calls across the Wasm and JS boundary: In performance-critical code or tight loops, keep computation in Dart or batch values rather than making repeated interop calls per iteration.
-
Find Wasm-compatible packages:
Use the
wasm-readyfilter on pub.dev to verify that packages usedart:js_interopandpackage:web.
Additional resources
#Explore previous JavaScript interop libraries:
Explore the API reference documentation:
Unless stated otherwise, the documentation on this site reflects Dart 3.14.0. Page last updated on 2026-11-10. View source or report an issue.