简体   繁体   中英

CachedNetworkImage throwing error after upgrading to latest Flutter Stable version

I upgraded Flutter today to version v1.12.13 but when I run the app, I get the following error -

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.

I am using the latest version of CachedNetworkImageProvider .

This currently looks like an active issue . Changing the version to 2.0.0-rc fixes the error for time being.

As mentioned in the official page

Breaking change with ImageProvider.load in Flutter 1.10

The Flutter team made a breaking change with the ImageProvider in Flutter 1.10.15 (currently Master channel only).

If you are experiencing one of the following errors upgrade to 2.0.0-rc.

switch to cached_network_image: ^2.0.0-rc

If the issue still persists then try flutter clean and run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM