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

Flutter项目执行flutter pub get报错,调整版本仍无法解决

Flutter pub get依赖解析错误解决方案

Resolving dependencies...
Because no versions of flutter_secure_storage_windows match 1.1.3 and no versions of flutter_secure_storage_windows match >1.1.3 <2.0.0, flutter_secure_storage_windows ^1.1.3 is forbidden.
So, because fstore depends on flutter_secure_storage ^7.0.1 which depends on flutter_secure_storage_windows ^1.1.3, version solving failed.
pub get failed

  • 升级flutter_secure_storage到兼容新版本
    问题核心是flutter_secure_storage ^7.0.1依赖的flutter_secure_storage_windows ^1.1.3版本不存在或无法匹配。直接升级主包到最新稳定版,它会自动适配正确的平台依赖。修改pubspec.yaml:

    dependencies:
      flutter_secure_storage: ^最新稳定版本号
    

    执行flutter pub get即可。

  • 强制指定flutter_secure_storage_windows有效版本
    若不想升级主包,可在pubspec.yaml中直接声明该平台包的有效版本(如1.1.2或2.0.0+),覆盖主包的依赖约束:

    dependencies:
      flutter_secure_storage: ^7.0.1
      flutter_secure_storage_windows: ^2.0.0 # 替换为实际存在的稳定版本
    

    执行flutter pub get让pub重新解析版本组合。

  • 清理缓存后重试
    若修改后仍报错,清理pub缓存再尝试:

    flutter pub cache clean
    flutter pub get
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 04:22:01