Flutter 使用 device_info_plus 遇到的问题

问题:引用device_info_plus 插件出现了异常,不知道为啥打开项目的时候就不能用了。

解决:改了版本解决

c 复制代码
Target of URI doesn't exist: 'package:device_info_plus/device_info_plus.dart'. 
(Documentation)  Try creating the file referenced by the URI, or try using a URI for a file
 that does exist.



在项目中用的是9.1.0,然后改成 3.0.2就行了

而后,又出现如下的错误:两个依赖的版本冲突了,哎,把 package_info_plus 去掉吧,如果没有使用到,或者换插件换插件,其他不知道怎么解决了

c 复制代码
Because device_info_plus >=3.2.1 <4.0.1 depends on device_info_plus_windows ^2.1.1 and device_info_plus >=2.1.0 <3.2.1 depends on device_info_plus_windows ^2.1.0, device_info_plus >=2.1.0 <4.0.1 requires device_info_plus_windows ^2.1.0.
And because device_info_plus_windows >=1.0.0-nullsafety.0 <3.0.0 depends on win32 ^2.0.0 and package_info_plus >=4.0.1 depends on win32 >=4.0.0 <6.0.0, device_info_plus >=2.1.0 <4.0.1 is incompatible with package_info_plus >=4.0.1.
So, because a302 depends on both package_info_plus ^4.2.0 and device_info_plus ^3.0.2, version solving failed.


You can try the following suggestion to make the pubspec resolve:
* Try upgrading your constraint on device_info_plus: flutter pub add device_info_plus:^9.1.0
Process finished with exit code 1
相关推荐
杉氧13 小时前
弹性滚动的奥秘:在 Flutter 中使用 CustomScrollView 与 Sliver 打造极致流畅列表
android·前端·flutter
张风捷特烈14 小时前
Flutter UI 解耦 - 天下大势,合久必分, 分久必合
android·前端·flutter
Patrick_Wilson1 天前
从 React 到 Flutter:写给前端的一张跨端知识地图
前端·flutter·react.js
奎叔1 天前
Flutter 分层架构:从页面堆叠到可演进的业务边界
flutter
奎叔1 天前
Flutter 客户端 Trace 与稳定性治理:从链路追踪到灰度、降级和复盘
flutter
GitLqr1 天前
别被“Flutter 传感器延迟 150ms”带偏了:这可能只是你的实现方式错了
flutter·架构·kotlin
杉氧1 天前
Flutter 像素级还原实战:用 CustomPaint 与 Bezier 曲线手绘精致图针
android·前端·flutter
山璞2 天前
将一个 Flutter 项目转为用 ArkUI-X 框架实现(4)
flutter·harmonyos
GitLqr2 天前
彻底搞懂 Dart Stream:从底层原理到 Flutter 实战与面试题集
flutter·响应式编程·dart
louisgeek3 天前
Flutter Visibility 和 Offstage 的区别
flutter