简体   繁体   English

文本'是从两个平台导入的

[英]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_htmlflutter 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.

相关问题 错误:“ModalBottomSheetRoute”是从两者导入的 - Error: 'ModalBottomSheetRoute' is imported from both 'Size' 是从 'dart:ffi' 和 'dart:ui' Flutter 3 导入的 - 'Size' is imported from both 'dart:ffi' and 'dart:ui' Flutter 3 错误:“设置”是从“两个包”导入的。 我能做些什么来解决这个问题? - Error: 'Settings' is imported from "both packages." What can I do to fix this? Flutter 错误:GooglePayButton 是从“flutter_stripe”和“pay”包中导入的 - Flutter error: GooglePayButton is imported from both 'flutter_stripe' and a 'pay' packages DualTransitionBuilder 是从 'package:flutter/src/widgets/dual_transition_builder.dart' 和 - DualTransitionBuilder is imported from both 'package:flutter/src/widgets/dual_transition_builder.dart' and 如何在 flutter 中制作一个适用于两个平台的支付网关 - How to make an payment gateway in flutter, that works in both the platforms 如何在两个平台上读取 Wi-Fi SSID | iOS - How to read Wi-Fi SSID in both platforms | iOS 多个平台的文本字段警报对话框 - Text field alert dialog for multiple platforms 'Router' 是从 'package:fluro/src/router.dart' 和 'package:flutter/src/widgets/router.dart' 导入的 - 'Router' is imported from both 'package:fluro/src/router.dart' and 'package:flutter/src/widgets/router.dart' ModalBottomSheetRoute' 是从 'package:flutter/src/material/bottom_sheet.dart' 和 package:modal_bottom_sheet 导入的 - ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and package:modal_bottom_sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM