talker icon indicating copy to clipboard operation
talker copied to clipboard

Fix WebAssembly incompatible cast in download_logs_web.dart

Open Copilot opened this issue 2 months ago • 0 comments

Thanks a lot for contributing!

Provide a description of your changes below

The downloadFile function was casting JSString to JSObject, which violates WebAssembly type safety rules and triggers invalid_runtime_check_with_js_interop_types lint error during flutter build web.

Changed:

// Before: invalid cast for WebAssembly
final jsArray = JSArray.from<JSString>(logs.toJS as JSObject);

// After: proper JS interop pattern
final jsArray = [logs.toJS].toJS;

The fix uses the standard dart:js_interop pattern where a Dart list containing the JSString is converted to JSArray<JSString> via .toJS extension, eliminating the incompatible cast.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/flutter_infra_release/flutter/1527ae0ec577a4ef50e65f6fefcfc1326707d9bf/dart-sdk-linux-x64.zip
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter-sdk/bin/cache/dart-sdk-linux-x64.zip REDACTED cts/products_repository.dart cts/models/models.dart cts/models/product.dart cts/ cts/abstarct_products_repository.dart bloc/bloc.dart (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Web Wasm - wrong casting</issue_title> <issue_description>Describe the bug I'm getting this incompatibility with WebAssembly: /.pub-cache/hosted/pub.dev/talker_flutter-5.1.7/lib/src/utils/download_logs/download_logs_web.dart 6:42 - invalid_runtime_check_with_js_interop_types lint violation: Cast from 'JSString' to 'JSObject' casts a JS interop value to an incompatible JS interop type, which might not be platform-consistent. (10)

To Reproduce flutter build web

Expected behavior Works with WebAssembly </issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes Frezyx/talker#457

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Dec 15 '25 05:12 Copilot