admin管理员组文章数量:1336183
I am trying to get my current Flutter app to run on web. I called flutter create .
but if I try running it in Chrome I get prompted with about 10000 error messages which all look like this:
Try removing the 'external' keyword or adding a JS interop annotation. external ffi.Pointer<OBX_id_array> removals; ^
../../flutter/.pub-cache/hosted/pub.dartlang/objectbox-1.1.0/lib/src/native/bindings/objectbox-c.dart:6289:41: Error: Only JS interop members may be 'external'. Try removing the 'external' keyword or adding a JS interop annotation. external ffi.Pointer<OBX_sync_change> list; ^
../../flutter/.pub-cache/hosted/pub.dartlang/objectbox-1.1.0/lib/src/native/bindings/objectbox-c.dart:6292:16: Error: Only JS interop members may be 'external'. Try removing the 'external' keyword or adding a JS interop annotation. external int count; ^
Failed to pile application.
I tried googling it but I couldn't find anything on this. Does anyone know what this is about and how I can fit this??
I am trying to get my current Flutter app to run on web. I called flutter create .
but if I try running it in Chrome I get prompted with about 10000 error messages which all look like this:
Try removing the 'external' keyword or adding a JS interop annotation. external ffi.Pointer<OBX_id_array> removals; ^
../../flutter/.pub-cache/hosted/pub.dartlang/objectbox-1.1.0/lib/src/native/bindings/objectbox-c.dart:6289:41: Error: Only JS interop members may be 'external'. Try removing the 'external' keyword or adding a JS interop annotation. external ffi.Pointer<OBX_sync_change> list; ^
../../flutter/.pub-cache/hosted/pub.dartlang/objectbox-1.1.0/lib/src/native/bindings/objectbox-c.dart:6292:16: Error: Only JS interop members may be 'external'. Try removing the 'external' keyword or adding a JS interop annotation. external int count; ^
Failed to pile application.
I tried googling it but I couldn't find anything on this. Does anyone know what this is about and how I can fit this??
Share Improve this question asked Jul 13, 2021 at 20:06 ChrisChris 2,3149 gold badges63 silver badges145 bronze badges 1- 1 Well I was using moor db, I had to remove import 'package:moor/ffi.dart'; since it support only mobile devices – Kunchok Tashi Commented Sep 1, 2021 at 16:05
2 Answers
Reset to default 7Re-posting the answer from a GitHub issue here:
You can't build your app for the web with packages that don't support web, which ObjectBox doesn't yet (there's an issue you can track though).
Sometimes you may want to have the dependency in a small part of the code and it's fine if it doesn't work for the web, in that case, you can use "conditional imports", such as:
import 'myapp/sources-that-use-objectbox.dart' if (dart.library.html) 'myapp/sources-that-dont-use-objectbox.dart';
In my case I had accidentally used the "ffi" library which is not supported by the web. I then removed all the import made of this library in my code and I also removed the library from "pubsec.yaml". It now launches normally.
本文标签:
版权声明:本文标题:javascript - Flutter app running on web failing with error: Only JS interop members may be 'external' - Stack Ov 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742394657a2466678.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论