When I use the latest version of flutter, the following error will be reported when I introduce this library
Compiler message:
../../../../macLib/flutter/.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-1.1.2+1/lib/src/cached_network_image_provider.dart:53:24: Error: The method 'CachedNetworkImageProvider.load' has fewer positional arguments than those of
overridden method 'ImageProvider.load'.
ImageStreamCompleter load(CachedNetworkImageProvider key) {
^
../../../../macLib/flutter/packages/flutter/lib/src/painting/image_provider.dart:403:24: Context: This is the overridden method ('load').
ImageStreamCompleter load(T key, DecoderCallback decode);
^
../../../../macLib/flutter/.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-1.1.2+1/lib/src/scaled_file_image.dart:45:24: Error: The method 'ScaledFileImage.load' has fewer positional arguments than those of overridden method
'ImageProvider.load'.
ImageStreamCompleter load(ScaledFileImage key) {
^
../../../../macLib/flutter/packages/flutter/lib/src/painting/image_provider.dart:403:24: Context: This is the overridden method ('load').
ImageStreamCompleter load(T key, DecoderCallback decode);
^
Exception: Errors during snapshot creation: null
This is my version of Flutter:
Flutter 1.10.15-pre.166 • channel master • https://github.com/flutter/flutter.git
Framework • revision 1781d5c9bb (18 minutes ago) • 2019-10-17 19:22:47 -0700
Engine • revision 508146f0de
Tools • Dart 2.6.0 (build 2.6.0-dev.8.0 f020ce5d23)
Please see the readme on the frontpage (https://github.com/renefloor/flutter_cached_network_image)
You can keep this issue open for reference, so hopefully less people open issues.
I have same problem~
@DLErice So did you read the frontpage? You can download 2.0.0-rc and everything should work fine. Or just use the stable channel of Flutter....
@renefloor when will this issue will be resolved ?
It is already solved, you just need to use 2.0.0-rc. I won't make it a stable version as long as it is only usable on master and maybe not even until flutter hits stable.
This change in flutter is a breaking change, so I can never make it backwards compatible.
@renefloor thanks for clarifying the doubt !
It is already solved, you just need to use 2.0.0-rc. I won't make it a stable version as long as it is only usable on master and maybe not even until flutter hits stable.
This change in flutter is a breaking change, so I can never make it backwards compatible.
How would I upgrade to cached_network_image v2.0.0-rc ?
When i moved from Flutter Stable to Flutter Dev (using command flutter channel dev then flutter channel upgrade) I was still only on Flutter SDK 1.10.7 and i was given this error when running flutter packages get
The current Flutter SDK version is 1.10.7.
Because artstumble depends on cached_network_image >=2.0.0-rc which requires Flutter SDK version >=1.10.15-pre.148 <2.0.0, version solving failed.
@maylortaylor I just tried on beta, which is on 1.10.7, but at that version cached_network_image 1.1.2 should still work. Do you have any issues with that version?
@renefloor Looks like the breaking change has rolled out to dev channel, I just created CI build to confirm: https://github.com/renefloor/flutter_cached_network_image/pull/283
@renefloor I have a project that currently has to target on flutter dev channel because of a hard dependency on its FFI features, and it's really annoying that breaking changes on ImageProvider APIs are introduced. I would suggest separating out the ImageProvider API as a standalone package to make the widget api work for all channels, what do you think?
@hanabi1224 It could be a solution, but I'm afraid many people won't understand what is the difference between the two and will complain that they can't use it while they actually need to other package. We just have to go through this phase of having 2 incompatible versions.
Do you also need to build the same app on more stable flutter channels? Otherwise you can just use version 2.0.0 right?
@renefloor I only need to build against flutter dev (currently 1.10.15) however 2.0.0-rc.1 does not work for me (The same error may come from some other packages tho, I will take another look to confirm) : (
I just upgraded to 1.11.0 beta release and then also faced the "the method 'networkImageWithRetry.load' has fewer positional arguments..." error. Unfortunately 2.0.0-rc.1 does not solve the problem. Anything I can try? Thanks :)
/edit: My bad, the error is connected to another plugin advanced_networkimage. Sorry
had this bug too today
i switch flutter to beta (v1.11.0) and changed this plugin to 2.0.0-rc.1 to solve this and got a bunch of gradle errors that got complected
finally i switch back to stable (1.9.1+hotfix.6) and behold the bug is gone
@renefloor thank you for this awesome plugin and all the support !!!
It's not working with the current stable release, 1.12.13+hotfix.5. Any news on this issue?
It's not working with the current stable release, 1.12.13+hotfix.5. Any news on this issue?
I just used 2.0.0-rc for now.
2.0.0-rc is not stable version
Worked for me with 2.0.0-rc
For now it worked for me with 2.0.0-rc with latest flutter 1.12
Also, it worked for me with 2.0.0-rc with latest flutter 1.12
Modifed on pubspec.lock:
cached_network_image:
dependency: "direct dev"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-rc"
added on dev_dependencies, pubspec.yaml:
cached_network_image: 2.0.0-rc
For mee too it worked 2.0.0-rc with latest flutter 1.12
Had the same problem, after reading the README file, everything was fine again, I can proceed.
FYI I am running:
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.13.0, on Mac OS X 10.14.6 18G1012, locale en-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.40.2)
[✓] Connected device (1 available)
Please see the readme on the frontpage (https://github.com/renefloor/flutter_cached_network_image)
You can keep this issue open for reference, so hopefully less people open issues.
I solved it perfectly after upgrading to cached_network_image: ^2.0.0-rc.
Thank you so much!!
Well this got a lot of traction. Worked fine after upgrading to 2.0.0-rc and the new stable version of flutter (1.12). I guess the Flutter team was right for one thing. The community is beyond great!
Also, it worked for me with 2.0.0-rc with latest flutter 1.12
Modifed on pubspec.lock:
cached_network_image:
dependency: "direct dev"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0-rc"added on dev_dependencies, pubspec.yaml:
cached_network_image: 2.0.0-rc
It's worked for me at Flutter: 1.12.13+hotfix.5. Thanks
Download and reinstall the flutter sdk
[note My Flutter: 1.12.13+hotfix.5 ]
There is a problem with [ flutter_map ] try to avoid it [when I remove it from [ pubspec.yaml ] all my mistake is gone without any reinstall of flutter sdk :]
[note My Flutter: 1.12.13+hotfix.5 ]
i have the same problem the [flutter_map] and [flutter_map_marker_cluster] depend form [cached_network_image] , i can't switch to version 2.0.0-rc
solution :
Upgrade in Flutter_map pubspec.yaml:
flutter_image : 3.0.0
cached_network_image: 2.0.0-rc
Go to cached_network_image_provider.dart and add DecoderCallback decode, as a second parameter in CachedNetworkImageProvider.load() function
@override
ImageStreamCompleter load(
CachedNetworkImageProvider key, DecoderCallback decode) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key),
scale: key.scale,
);
}
Go to mbtiles_image_provider.dart and again add DecoderCallback decode, as a second parameter in ImageProvider.load() function
It should work for now.
You're right, the problem is described in this post https://pub.dev/documentation/cached_network_image/latest/
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).
https://pub.dev/packages/cached_network_image/versions/2.0.0-rc.1#-installing-tab-
What should I pass to second parameter of CachedNetworkImageProvider.load?
It now requires a DecoderCallback decode, but there is no docs saying nothing about it =
Flutter 1.12.13+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (12 days ago) • 2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0
I updated the Flutter to latest today and got this error and read the repo readme and act on it. Everything works fine now thanks to package owner Rene Floor
Just increment the package in pubspec.yaml as suggested by the owner:
cached_network_image: ^2.0.0-rc
By package owner:
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.
The method 'ScaledFileImage.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'
The method 'CachedNetworkImageProvider.load' has fewer positional arguments than those of overridden method
Since we're at 1.12+ on stable, can 2.0rc be released as a regular version, @renefloor ?
@renefloor
Everyone knows this problem and already knows how to solve it, then I will close this problem
i have same proble this type,.,, anyone can give me solution
@deepkachchhawah do you use version 2.0.0 or 1.x? It should be fixed in 2.0.0
By adding DecoderCallback decode as second argument fix the problem. Upgrade to lastest.
@override
ImageStreamCompleter load(CachedNetworkImageProvider key, DecoderCallback decode) {
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key),
scale: key.scale,
informationCollector: () {
return [
DiagnosticsNode.message('Image provider: $this'),
DiagnosticsNode.message('Image key: $key'),
];
});
}
2.0.0-rc worked like a charm... Thanks alot
Please see the readme on the frontpage (https://github.com/renefloor/flutter_cached_network_image)
You can keep this issue open for reference, so hopefully less people open issues.
I have read but nothing special there what exactly is nouveau there? or significantly different from the actual implementation example given given here https://pub.dev/packages/cached_network_image
For mee too it worked 2.0.0-rc with latest flutter 1.12
for me it's not working on the current latest stable release of Flutter which is at the time of this posting 1.17.2
@Chimba123 which version of CachedNetworkImage are you using and what's the exact error you get?
I have just updated to cached_network_image: ^2.0.0-rc in the pubspec. The problem is that the placeholder in the CachedNetworkImage widget is not being replaced by the loaded images from the network it was working before but its just stuck on the loader or the blur hash
this is my code:
CachedNetworkImage(
imageUrl: '${hits[index].largeImageURL}',
placeholder: (context, url) => const AspectRatio(
aspectRatio: 1.6,
child: BlurHash(hash: 'LEHV6nWB2yk8pyo0adR*.7kCMdnj'),
),
errorWidget: (context, url, error) => const Icon(Icons.refresh),
fit: BoxFit.cover,
),
the blur hash widget is not fading out to show the loaded state/images
then I am also getting this error:
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getTemporaryDirectory on channel plugins.flutter.io/path_provider)
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)

The placeholder is just stuck there... even though the state is loaded as shown by the bloc in the console as below:
flutter: onTransition Transition { currentState: SocialsFeedLoading, event: FetchSocialsFeed, nextState: SocialsFeedLoaded }
flutter: [SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel, SocialsFeedModel]
The last state is "SocialsFeedLoaded" and the model is loaded but the data is not being shown in the CacheNetwrokImage .. but it used too previously before the upgrade
But that has nothing to do with "The method 'CachedNetworkImageProvider.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'", so why do you post here as if you have this issue?
@renefloor > I have just updated to cached_network_image: ^2.0.0-rc in the pubspec I did that just a few minutes ago and that specific error is gone but the issue of the plugin not working remains after doing what you suggested
Most helpful comment
It is already solved, you just need to use 2.0.0-rc. I won't make it a stable version as long as it is only usable on master and maybe not even until flutter hits stable.
This change in flutter is a breaking change, so I can never make it backwards compatible.