I’m converting one of my packages from dart:html to using package web and js interop in preparation for wasm compilation and encountering the following error -
This looks like JS string was not properly converted to Dart String on the boundary. You need to post a more complete code for us to be able to help you. This can be a mistake in your code (e.g. you specified weak signature somewhere and then just did a cast from a JS value to a Dart String) or there can be a bug in the JS interop implementation. In either case we will need to see more code to understand it.
Please pull this repo and switch to branch issue33.
I’m running a unit test file as below -
dart test test/lib/sporran_test.dart -p chrome
The first failure point is lib/src/sporran_database.dart line 553
This codebase is very old by modern dart standards as you will see, it could do with a rewrite to use async/await(wasn’t available 10 years ago) but I don’t see why this would affect anything.
Sorry for the work here but I don’t think posting endless code snippets will help.
I have tried that and I get all kinds of exceptions but not the get$isNotEmpty one you have mentioned in the issue. I have tried both stable and main branches of Dart.
I also see that the code is changed compared to what you describe (e.g. you have revision.toJS.isDefinedAndNotNull instead of revision.isNotEmpty in the code).
Yep, you’ll need a running couchdb instance with CORS configuration set to run the tests, for some reason I had just assumed you would be inspecting the generated code only, my bad.
However, a combination of your comment above about how the function is being called and my observation that this code is old has lead to a resolution.
The code base uses dynamic far too much, looks as though this seems to cause type elision in some circumstances when compiling to JS. The fix of course is to get rid of these calls, works OK when dynamic is replaced with the actual type which only improves things to boot.
Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.
Using contents of this forum for the purposes of training proprietary AI models is forbidden. Only if your AI model is free & open source, go ahead and scrape.