dart-windows / win32

Build Win32 apps with Dart!
https://win32.pub
BSD 3-Clause "New" or "Revised" License
735 stars 118 forks source link

run Web Error: Dart library 'dart:ffi' is not available on this platform #840

Closed GanZhiXiong closed 2 months ago

GanZhiXiong commented 2 months ago
$ flutter run          
Connected devices:
macOS (desktop) • macos  • darwin-arm64   • macOS 13.5 22G74 darwin-arm64
Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.122

Checking for wireless devices...

[1]: macOS (macos)
[2]: Chrome (chrome)
Please choose one (or "q" to quit): 2
Launching lib/main.dart on Chrome in debug mode...

../../../../.pub-cache/hosted/pub.flutter-io.cn/win32-5.4.0/lib/src/bstr.dart:3:8: Error: Dart library 'dart:ffi' is not available on
this platform.
import 'dart:ffi';
       ^
Context: The unavailable library 'dart:ffi' is imported through these packages:

    web_entrypoint.dart => package:gan_flutter_demo => package:win32 => dart:ffi
    web_entrypoint.dart => package:gan_flutter_demo => package:win32 => package:ffi => dart:ffi
    ...

Detailed import paths for (some of) the these imports:

    web_entrypoint.dart => package:gan_flutter_demo/main.dart => package:win32/win32.dart => package:win32/src/bstr.dart => dart:ffi
    web_entrypoint.dart => package:gan_flutter_demo/main.dart => package:win32/win32.dart => package:win32/src/bstr.dart =>
    package:ffi/ffi.dart => package:ffi/src/allocation.dart => dart:ffi
...

When I delete the following import, this error disappears, but if I want to run it on Windows, I need to import it again, which makes it troublesome for me to compile back and forth into a Web or Windows application.

import 'package:win32/win32.dart';