fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.29k stars 300 forks source link

Dart library 'dart:js_interop' is not available on this platform. #2276

Closed niuhuan closed 2 months ago

niuhuan commented 2 months ago

Describe the bug

Launching lib/main.dart on iPhone 15 in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           138.4s
Failed to build iOS app
Error (Xcode): /Users/niuhuan/.pub-cache/hosted/pub.dev/flutter_rust_bridge-2.3.0/lib/flutter_rust_bridge_for_generated_web.dart:4:1: Error: Dart library 'dart:js_interop' is not available on this platform.

Steps to reproduce

  1. flutter_rust_bridge_codegen create --org opensource --rust-crate-name kobi_rust myapp
  2. flutter_rust_bridge_codegen generate
  3. flutter run (run on ios emulator)

Logs

Is to long , I think is not important at this issue

Expected behavior

No response

Generated binding code

No response

OS

Macos

Version of flutter_rust_bridge_codegen

No response

Flutter info

git:(main) ✗ flutter doctor version
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.3, on macOS 14.2.1 23C71 darwin-arm64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2.0.2)
[✓] VS Code (version 1.92.2)
[✓] Connected device (5 available)


### Version of `clang++`

_No response_

### Additional context

It's not working on flutter 3.22.3
fzyzcjy commented 2 months ago

Hmm, are you using wasm or js? You can use the js for flutter web before the wasm is migrated.

niuhuan commented 2 months ago

I'm building a Flutter app for iOS, I am trying to upgrade FlutterSDK

fzyzcjy commented 2 months ago

Hmm, why would ios require this... Could you please create a minimal reproducible sample?

P.S. In CI, we test on flutter 3.22.0 (should be almost same as 3.22.3 since the latter only contains critical bug fix) https://github.com/fzyzcjy/flutter_rust_bridge/blob/bfc421994e755b9cbc24260f4ab5423afffb9130/.github/workflows/ci.yaml#L14

fzyzcjy commented 2 months ago

And try to run flutter run --verbose to see more logs

niuhuan commented 2 months ago

upgrade flutter to latest stable version before run flutter_rust_bridge_codegen create, this problem has been solved.

Maybe the flutter version too old at the project.

fzyzcjy commented 2 months ago

Happy to see it is solved!

github-actions[bot] commented 2 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.