example: remove and ignore pubspec.lock#258
Conversation
| invalidAccessErrorIsArgumentError: invalidAccessErrorIsArgumentError, | ||
| ); | ||
| } catch (e) { | ||
| if (e.isA<subtle.JSDomException>()) { |
There was a problem hiding this comment.
how is this better? were we doing it wrong before?
There was a problem hiding this comment.
You can't do a normal on X check for JS exceptions. This doesn't work in Wasm!
There was a problem hiding this comment.
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.
No description provided.