You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行flutter pub get失败,依赖配置及路径错误求助

解决flutter_blue_plus example依赖错误的步骤

错误1:pubspec.yaml依赖来源冲突

pubspec.yaml第13行第5列错误:一个依赖只能有一个来源。
╷
13 │ ┌ sdk: flutter
14 │ │
15 │ │
16 │ │ # Note: We use a path dependency because the example app & plugin are bundled together.
17 │ │ # In your app you should use ^1.17.3 or similar
18 │ │ path: ../
19 │ └
╵

处理方法:

  • 打开C:\Users\Lokman\Downloads\flutter_blue_plus-1.35.3\example\pubspec.yaml文件
  • 找到第13行开始的flutter_blue_plus依赖块,删除sdk: flutter这一行,只保留path: ../,修改后该块内容如下:
flutter_blue_plus:
    # Note: We use a path dependency because the example app & plugin are bundled together.
    # In your app you should use ^1.17.3 or similar
    path: ../

错误2:flutter_blue_plus_web路径不存在

正在解析依赖项...
由于flutter_blue_plus_example依赖的flutter_blue_plus_web路径不存在(无法在"../../flutter_blue_plus_web"找到该包),版本解析失败。
包更新失败。

处理方法:

  1. 检查源码包完整性:

    • 打开C:\Users\Lokman\Downloads\flutter_blue_plus-1.35.3目录,确认是否存在flutter_blue_plus_web文件夹
    • 如果没有这个文件夹,说明下载的源码包不完整,重新下载flutter_blue_plus 1.35.3的完整源码包
  2. 修正路径配置:

    • 如果确认存在flutter_blue_plus_web文件夹,打开example目录下的pubspec.yaml,找到flutter_blue_plus_web的依赖配置
    • 将原路径../../flutter_blue_plus_web修改为../flutter_blue_plus_web(example目录的上级就是根目录,向上一级即可找到该文件夹)

最后验证

修改完成后,回到example目录的终端,重新执行:

flutter pub get

如果没有报错,说明依赖配置已修复。

内容的提问来源于stack exchange,提问作者HobiSoft

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 12:55:16