Fix Wasm incompatibility in web error processing#1684
Open
brunovsiqueira wants to merge 1 commit intoRevenueCat:mainfrom
Open
Fix Wasm incompatibility in web error processing#1684brunovsiqueira wants to merge 1 commit intoRevenueCat:mainfrom
brunovsiqueira wants to merge 1 commit intoRevenueCat:mainfrom
Conversation
Replace `is JSObject` runtime check with Wasm-safe `isA<JSObject>()` in `_processError`. The `is` operator on JS interop types is unreliable under Wasm compilation due to type erasure differences between JS and Wasm targets. Co-Authored-By: Claude Opus 4.6 <[email protected]>
d78f0e4 to
0f5743b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1651
Description
The
_processErrormethod inpurchases_flutter_web.dartuseserror is JSObject, which triggers theinvalid_runtime_check_with_js_interop_typeslint. Theisoperator on JS interop types is unreliable under Wasm compilation because JS interop types are erased differently between JS and Wasm targets.This replaces the runtime check with the Wasm-safe
isA<JSObject>()method fromdart:js_interop(available since Dart 3.4, and the project requires Dart >=3.6.0).Changes
lib/web/purchases_flutter_web.darterrortoJSAny?before checkingerror is JSObjectwithjsAny.isA<JSObject>()jsObjectviajsAny as JSObjectafter theisAconfirmationdart:js_interopis already imported)CHANGELOG.mdTest plan
dart format .— cleanflutter analyze lib— passes with no issues (theinvalid_runtime_check_with_js_interop_typeswarning is gone)flutter test— all 134 tests passcd revenuecat_examples/purchase_tester && flutter build web— web build verificationcd revenuecat_examples/purchase_tester && flutter build web --wasm— Wasm build verificationbundle exec fastlane run_api_tests— no public API changes (requires CI environment)Why no new unit tests
_processErroris a private method that usesdart:js_interoptypes requiring a web runtime. The repo has no web-platform test infrastructure (flutter test --platform chrome), and the change is a mechanical replacement of one pattern with its Wasm-safe equivalent.flutter analyzestatically catches the lint if it regresses. Adding web test infra would be out of scope for this bugfix.