【发布时间】:2021-08-28 10:12:31
【问题描述】:
我有 Flutter 应用程序,它为每个平台(移动、网络、窗口)使用不同的 webview 插件。
虽然我可以在web 和mobile 的基础上使用import 平台,但我无法为Windows 导入。
如果不是移动设备或网络,我尝试添加 else 条件,但它正在使用mobile 插件。
- 这就是我为 Web 和移动 (工作) 导入包的方式。
import 'package:eam_flutter/form/mobileui.dart'
if (dart.library.html) 'package:eam_flutter/form/webui.dart'
as multiPlatform;
- 这是我为 web、移动和 windows 导入包的方式(不工作,它显示移动 webview 异常,因为它不支持桌面)。
import 'package:eam_flutter/form/windowui.dart'
if (dart.library.html) 'package:eam_flutter/form/webui.dart'
if (dart.library.io) 'package:eam_flutter/form/mobileui.dart'
as multiPlatform;
如何为 windows 指定条件导入?
【问题讨论】:
-
@smorgan 有什么解决方法吗?
-
@codingwithtashi 解决方法是什么?这个问题没有说明要解决的问题,只是一个期望的解决方案,而那个特定的解决方案是不可能的。潜在问题可能还有其他解决方案。
-
@smorgan 我的意思是,如何让它在没有平台错误的情况下工作,但没关系我让它工作。谢谢
标签: flutter dart import flutter-web flutter-windows