我今天将Flutter升级到了v1.12.13
版,但是当我运行该应用程序时,出现以下错误-
Compiler message:
../../../../.pub-cache/hosted/pub.dartlang.org/cached_network_image-1.1.3/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) {
^
../../flutter_src/flutter/packages/flutter/lib/src/painting/image_provider.dart:403:24: Context: This is the overridden method ('load').
ImageStreamCompleter load(T key, DecoderCallback decode);
^
../../../../.pub-cache/hosted/pub.dartlang.org/multi_image_picker-4.5.9/lib/src/asset_thumb_provider.dart:31:24: Error: The method 'AssetThumbImageProvider.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'.
ImageStreamCompleter load(AssetThumbImageProvider key) {
^
../../flutter_src/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
build failed.
FAILURE: Build failed with an exception.
我正在使用CachedNetworkImageProvider
的最新版本。
答案 0 :(得分:1)
当前看起来像是活跃的issue。将版本更改为2.0.0-rc
可暂时修复该错误。
答案 1 :(得分:0)
在Flutter 1.10中使用ImageProvider.load进行更改
Flutter团队对Flutter 1.10.15(当前仅适用于主渠道)中的ImageProvider进行了重大更改。
如果遇到以下错误之一,请升级到2.0.0-rc。
切换到cached_network_image: ^2.0.0-rc
如果问题仍然存在,请尝试flutter clean
并运行。