Flutter项目执行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

