doc(web): update Wasm status page links and FAQ conditional imports#13622
doc(web): update Wasm status page links and FAQ conditional imports#13622kevmoo wants to merge 2 commits into
Conversation
kevmoo
commented
Jul 23, 2026
- Reference the package:web migration guide on the Wasm status page.
- Add warning notes pointing to Dart's Wasm JS-interop type cast and Zone documentation.
- Update Web FAQ with Wasm-compatible conditional import sample (dart.library.js_interop) and update link.
- Reference the package:web migration guide on the Wasm status page. - Add warning notes pointing to Dart's Wasm JS-interop type cast and Zone documentation. - Update Web FAQ with Wasm-compatible conditional import sample (dart.library.js_interop) and update link.
|
Staged preview of the updated docs.flutter.dev site (updated for commit 3d72e37): https://flutter-docs-prod--docs-pr13622-web-wasm-docs-fixes-6vfalqja.web.app |
|
This PR references Wasm-specific type check warnings and Zone-binding examples on the Dart documentation site. While the page anchors already exist, the new detailed content is currently staged in the corresponding Dart site PR: dart-lang/site-www#7401. It is recommended to land this PR after or in conjunction with the Dart PR. |
There was a problem hiding this comment.
Code Review
This pull request updates the Flutter web documentation with guidelines on WebAssembly (Wasm) compilation, conditional imports, and JS interop. It includes a migration guide link and details on runtime differences. Feedback on the changes identifies an issue in the conditional import code snippet: checking dart.library.js_interop first makes the subsequent dart.library.js check unreachable, since js_interop is supported on both JS and Wasm. Reversing the order of these checks is recommended.
|
Staged preview of the updated flutter.dev site (updated for commit 3d72e37): https://flutter-dev-230821--www-pr13622-web-wasm-docs-fixes-bfxghbib.web.app |
| on [dart.dev]({{site.dart-site}}). | ||
| in your app, use conditional imports. | ||
|
|
||
| When compiling for WebAssembly, check for `dart.library.js_interop` (rather than `dart.library.js` or `dart.library.html`, which are not supported on Wasm): |
There was a problem hiding this comment.
| When compiling for WebAssembly, check for `dart.library.js_interop` (rather than `dart.library.js` or `dart.library.html`, which are not supported on Wasm): | |
| When compiling for WebAssembly, check for `dart.library.js_interop` | |
| (rather than `dart.library.js` or `dart.library.html`, | |
| which are not supported on Wasm): |
| if (dart.library.js_interop) 'wasm_web_interop.dart'; | ||
| ``` | ||
|
|
||
| For more details, see the [documentation for conditional imports][] on [dart.dev]({{site.dart-site}}). |
There was a problem hiding this comment.
| For more details, see the [documentation for conditional imports][] on [dart.dev]({{site.dart-site}}). | |
| For more details, see the [documentation for conditional imports][] | |
| on [dart.dev]({{site.dart-site}}). |
| - [`package:web`][], which replaces `dart:html` (and other web libraries) | ||
| - [`dart:js_interop`][], which replaces `package:js` and `dart:js` | ||
|
|
||
| For a detailed guide on migrating existing code, see the [`package:web` migration guide][]. |
There was a problem hiding this comment.
| For a detailed guide on migrating existing code, see the [`package:web` migration guide][]. | |
| For a detailed guide on migrating existing code, | |
| see the [`package:web` migration guide][]. |
|
|
||
| For a detailed guide on migrating existing code, see the [`package:web` migration guide][]. | ||
|
|
||
| When compiling to Wasm, be aware of runtime differences in JS interop types (such as `is`/`as` type casts and Zone propagation in callbacks). For details, see Dart's [JS interop types documentation]({{site.dart-site}}/interop/js-interop/js-types#compatibility-type-checks-and-casts) and the [package:web Zones section]({{site.dart-site}}/interop/js-interop/package-web#zones). |
There was a problem hiding this comment.
| When compiling to Wasm, be aware of runtime differences in JS interop types (such as `is`/`as` type casts and Zone propagation in callbacks). For details, see Dart's [JS interop types documentation]({{site.dart-site}}/interop/js-interop/js-types#compatibility-type-checks-and-casts) and the [package:web Zones section]({{site.dart-site}}/interop/js-interop/package-web#zones). | |
| When compiling to Wasm, be aware of runtime differences | |
| in JS interop types (such as `is`/`as` type casts | |
| and Zone propagation in callbacks). | |
| For details, check out Dart's | |
| [JS interop types documentation]({{site.dart-site}}/interop/js-interop/js-types#compatibility-type-checks-and-casts) | |
| and the [package:web Zones section]({{site.dart-site}}/interop/js-interop/package-web#zones). |