Skip to content

example: remove and ignore pubspec.lock#258

Open
kevmoo wants to merge 3 commits intogoogle:masterfrom
kevmoo:remove_example_lockfile
Open

example: remove and ignore pubspec.lock#258
kevmoo wants to merge 3 commits intogoogle:masterfrom
kevmoo:remove_example_lockfile

Conversation

@kevmoo
Copy link
Copy Markdown

@kevmoo kevmoo commented Mar 19, 2026

No description provided.

invalidAccessErrorIsArgumentError: invalidAccessErrorIsArgumentError,
);
} catch (e) {
if (e.isA<subtle.JSDomException>()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how is this better? were we doing it wrong before?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You can't do a normal on X check for JS exceptions. This doesn't work in Wasm!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's not just incompatibility with Wasm, it's also extension types. on X is a runtime check, and at runtime, JSDomException is just some JSObject from a JS compiler's perspective and any JS value from dart2wasm's perspective. If you wanted to check that it actually is a JSDomException, you'll need to use interop to type-check, which is what isA does.

A slightly deeper dive into the differing semantics: https://dart.dev/interop/js-interop/js-types#compatibility-type-checks-and-casts. With a recent enough SDK version, you'll see on <interop_type> checks being linted as well.

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