Skip to content

doc(web): update Wasm status page links and FAQ conditional imports#13622

Open
kevmoo wants to merge 2 commits into
mainfrom
web-wasm-docs-fixes
Open

doc(web): update Wasm status page links and FAQ conditional imports#13622
kevmoo wants to merge 2 commits into
mainfrom
web-wasm-docs-fixes

Conversation

@kevmoo

@kevmoo kevmoo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
  • 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.
@flutter-website-bot

flutter-website-bot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

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

@kevmoo
kevmoo requested a review from conooi July 23, 2026 02:06
@kevmoo

kevmoo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

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.

@kevmoo
kevmoo marked this pull request as ready for review July 23, 2026 02:08
@kevmoo
kevmoo requested review from a team and sfshaza2 as code owners July 23, 2026 02:08

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sites/docs/src/content/platform-integration/web/faq.md Outdated
@flutter-website-bot

flutter-website-bot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}}).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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][].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants