flutter报错-‘CachedNetworkImageProvider.load‘ has fewer positional arguments than those of overridden

Compiler message:
…/…/…/Download/flutter/.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-1.0.0/lib/src/cached_network_image_provider.dart:42:24: Error: The method ‘CachedNetworkImageProvider.load’ has fewer positional arguments than
those of overridden method ‘ImageProvider.load’.
ImageStreamCompleter load(CachedNetworkImageProvider key) {
^
…/…/…/Download/flutter/packages/flutter/lib/src/painting/image_provider.dart:403:24: Context: This is the overridden method (‘load’).
ImageStreamCompleter load(T key, DecoderCallback decode);
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
Failed to build bundle.
Error launching application on iPhone SE (2nd generation).
在这里插入图片描述
在这里插入图片描述

  • 修改pubspec.yaml文件
    flutter报错-‘CachedNetworkImageProvider.load‘ has fewer positional arguments than those of overridden_第1张图片
  • 运行flutter run 又报错
    The current Flutter SDK version is 1.12.13+hotfix.9.

Because cached_network_image >=2.3.0-beta.1 <2.3.0-rc depends on flutter_cache_manager ^1.3.0 and cached_network_image >=1.1.2 <2.1.0 depends on flutter_cache_manager ^1.1.2, cached_network_image >=1.1.2 <2.1.0-∞ or >=2.3.0-beta.1 <2.3.0-rc requires flutter_cache_manager ^1.1.2.
And because cached_network_image >=2.1.0 <2.3.0-beta.1 depends on flutter_cache_manager ^1.2.0 and cached_network_image >=2.3.0-rc requires Flutter SDK version >=1.19.0-2.0.pre <2.0.0, cached_network_image >=1.1.2 requires flutter_cache_manager ^1.1.2.
So, because doubanapp depends on both flutter_cache_manager 1.1.0 and cached_network_image ^2.0.0-rc, version solving failed.
Running “flutter pub get” in FlutterDouBan…
pub get failed (1; So, because doubanapp depends on both flutter_cache_manager 1.1.0 and cached_network_image ^2.0.0-rc, version solving failed.)
在这里插入图片描述

  • 可以看到cached_network_image版本更新后,与flutter_cache_manager版本起冲突,并且已经提示flutter_cache_manager版本更改1.1.2就可以了,
  • 解决:
  • 修改pubspec.yaml文件
    在这里插入图片描述
  • as中点击运行Pub get 重新获取包依赖或者手动运行flutter packages get 命令来下载依赖包。另外

你可能感兴趣的:(flutter)