[英]Text' is imported from both Platforms
i am working on a flutter project.我正在做一个 flutter 项目。 I am creating an app that could run on both mobile and web simultenously.
我正在创建一个可以同时在移动设备和 web 上运行的应用程序。 for platform checking i used kIsWeb constant which is working fine on Web but when i run the app on Mobile (android) then it says that some of widgets are imported for both packages like in this example.
对于平台检查,我使用了 kIsWeb 常量,它在 Web 上运行良好,但是当我在 Mobile (android) 上运行该应用程序时,它表示为两个包导入了一些小部件,如本例所示。
Text' is imported from both 'package:universal_html/src/html.dart' and 'package:flutter/src/widgets/text.dart'.
i google it and i found a package universal_html
but when i used this imprt in my project this gave mein the same error.我用谷歌搜索,发现了一个 package
universal_html
但是当我在我的项目中使用这个 imprt 时,这给了我同样的错误。 is there any thing that i am missing from my code?我的代码中有什么遗漏的吗? if yes.
如是。 then highlight my mistake and guid me in this regard.
然后强调我的错误并在这方面指导我。
This happened because you export Text
in both universal_html
and flutter
package, I recommend use prefiex on universal_html
like this:发生这种情况是因为您在
universal_html
和flutter
package 中导出Text
,我建议在universal_html
上使用前缀,如下所示:
import 'package:universal_html/src/html.dart' as universal_html;
and use it like this for example:并像这样使用它,例如:
final div = universal_html.DivElement();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.