gpt4 book ai didi

web - 在 flutter web 中使用 flutter 移动包

转载 作者:IT王子 更新时间:2023-10-29 07:18:23 24 4
gpt4 key购买 nike

我正在使用 flutter web,我想在 web 版本的 flutter 中使用一些可用于移动设备的包。 flutter web 的 pubspec 看起来与 flutter mobile 的有点不同,但这不是真正的问题。我担心的是,是否可以将可用于移动设备的软件包添加到网络软件包中。如果是,这样做的正确方法是什么?

最佳答案

目前(截至 2019 年 6 月)对于任何依赖于移动操作系统的软件包来说都是不可能的。这样做的原因是,移动设备上的插件使用平台 channel 与 Android 和 iOS 的平台相关代码实现进行通信,这些代码实现是用 java/kotlin for android 或 objc/swift for iOS 编写的。

这些包在 web 上工作的唯一方法是为它们编写特定于 web 的实现,我认为这将使用 emscripten 编译的库或更可能是某种 javascript 桥来调用相关的浏览器 API .

来自 flutter for web readme :

flutter_web does not have a plugin system yet. Temporarily, we provide access to dart:html, dart:js, dart:svg, dart:indexed_db and other web libraries that give you access to the vast majority of browser APIs. However, expect that these libraries will be replaced by a different plugin API.


对于任何是 100% dart 代码的插件,您应该能够像在 flutter 中一样将其包含在 pubspec.yaml 中 - 在 dependencies 下.

关于web - 在 flutter web 中使用 flutter 移动包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56589163/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com