英文:
How can i use cach network image in my flutter app
问题
I am trying to install cached network image package in my flutter project but I keep getting this error message.
解决依赖关系... 因为 cached_network_image >=3.2.0 依赖于 flutter_cache_manager ^3.3.0,而 flutter_cache_manager 又依赖于 http ^0.13.0,所以 cached_network_image >=3.2.0 需要 http ^0.13.0。因此,由于项目同时依赖于 cached_network_image ^3.2.3 和 http ^1.0.0,版本解析失败。退出码 1。
解决依赖关系... 因为 cached_network_image >=3.2.0 依赖于 flutter_cache_manager ^3.3.0,而 flutter_cache_manager 又依赖于 http ^0.13.0,所以 cached_network_image >=3.2.0 需要 http ^0.13.0。因此,由于项目同时依赖于 cached_network_image ^3.2.3 和 http ^1.0.0,版本解析失败。
英文:
I am trying to install cached network image package in my flutter project but i keep getting this error message
> Resolving dependencies... Because cached_network_image >=3.2.0 depends
> on flutter_cache_manager ^3.3.0 which depends on http ^0.13.0,
> cached_network_image >=3.2.0 requires http ^0.13.0. So, because
> project depends on both cached_network_image ^3.2.3 and http ^1.0.0,
> version solving failed. exit code 1
>
> Resolving dependencies... Because cached_network_image >=3.2.0 depends
> on flutter_cache_manager ^3.3.0 which depends on http ^0.13.0,
> cached_network_image >=3.2.0 requires http ^0.13.0. So, because
> depends on both cached_network_image ^3.2.3 and http ^1.0.0, version
> solving failed.
答案1
得分: 0
在您的项目中存在依赖冲突。暂时,您可以将您的 http
包降级到与 cached_network_image
和您的项目都兼容的版本(例如 http: ^0.13.6
)。
此外,在 cached_network_image
存储库中有一个拉取请求解决了这个问题,但尚未合并。
英文:
There is a dependency conflict in your project. Temporarily, you can downgrade your http
package to a version that is compatible with both cached_network_image
and your project (e.g., http: ^0.13.6
).
Also there is a pull request in the cached_network_image
repository that solves this problem, but it hasn't been merged yet.
答案2
得分: 0
项目中存在依赖冲突。我认为你可以通过在你的 pubspec.yaml
文件中使用 dependency_overrides:
来解决这个问题。
dependency_overrides:
用于手动覆盖依赖。你可以手动覆盖 http:
和 cached_network_image:
包到特定版本来解决这个问题。
像这样:
dependency_overrides:
http: 0.1x.x
cached_network_image: 3.x.x
关于每个包的版本,请参考你的 Flutter SDK 和 Dart SDK 版本来选择适当的版本。
英文:
There is dependency conflict in your project. And I think you can resolve via using dependency_overrides:
in you pubspec.yaml
.
dependency_overrides:
is for manual override. you are
I think manually overriding the http:
and cached_network_image:
packages to a specific version would solve this problem.
Like this.
dependency_overrides:
http: 0.1x.x
cached_network_image: 3.x.x
For the version of each package, Please choice the appropriate version by referring to your Flutter SDK and Dart SDK versions.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论