使用FVM切换至Flutter 3.32.x稳定版时依赖冲突问题求助
大家好,我最近在尝试用FVM升级Flutter版本时遇到了棘手的依赖冲突问题,折腾了好一阵没搞定,来求助社区的大佬们🙏
我目前在用Flutter 3.29.0,FVM版本是3.2.1,打算切换到最新的稳定版Flutter 3.32.x,已经通过FVM安装了3.32.0和3.32.5两个版本。但当我执行fvm use 3.32.0或者fvm use 3.32.5的时候,直接触发了依赖版本不兼容的错误:
Note: intl is pinned to version 0.20.2 by flutter_localizations from the flutter SDK.
Because my_project depends on flutter_localizations from sdk which depends on intl 0.20.2, intl 0.20.2 is required.
So, because my_project depends on intl ^0.19.0, version solving failed.
You can try the following suggestion to make the pubspec resolve:
Try upgrading your constraint on intl: flutter pub add intl:^0.20.2
Failed to update packages.
终端接着问我是否要继续固定当前版本,我选了no,然后就收到了「Dependencies not resolved」的提示。
我按照提示尝试手动调整依赖:先把pubspec.yaml里的intl: ^0.19.0删掉,再执行flutter pub add intl:^0.20.2,结果反而弹出了反向的冲突错误:
Note: intl is pinned to version 0.19.0 by flutter_localizations from the flutter SDK.
Because my_project depends on flutter_localizations from sdk which depends on intl 0.19.0, intl 0.19.0 is required.
So, because my_project depends on intl 0.20.2, version solving failed.
Failed to update packages.
我的pubspec.yaml里的依赖相关片段如下:
dependencies: flutter: sdk: flutter flutter_web_plugins: sdk: flutter flutter_localizations: sdk: flutter intl: ^0.19.0 intl_utils: ^2.8.8 intl_translation: ^0.20.1 # ... 其他依赖配置
现在我有两个核心疑问:
- 针对这个intl版本冲突的问题,有没有合适的解决办法?
- 为什么我用FVM切换到最新Flutter稳定版的时候会出现这种问题?
内容来源于stack exchange




