0
CircleAvatar(
                    radius: 40.0,
                    backgroundColor: Colors.blue,
                    backgroundImage: 
                        user.profileImageUrl.isEmpty 
                            ? AssetImage('assets/images/user.png') 
                            : CachedNetworkImageProvider(user.profileImageUrl),
                  ),

It says the 'CachedNetworkImageProvider.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'.

and when I hit the flutter run, it is giving me the following

/C:/Users/Acer/AppData/Roaming/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) {
                       ^
/D:/Flutter/flutter/packages/flutter/lib/src/painting/image_provider.dart:403:24: Context: This is the overridden method ('load').
  ImageStreamCompleter load(T key, DecoderCallback decode);
                       ^

4 Answers 4

3

Make sure you are using rc version of cached_network_image.

Add this to your pubspec.yaml file cached_network_image: ^2.0.0-rc and run flutter pub get

Sign up to request clarification or add additional context in comments.

Comments

2

I faced this issue today, the things I have follow:

  1. try to delete .idea folder. (Not working for me).
  2. Flutter clean. (Not working for me).
  3. Remove cached_network_image from pubspec.yaml and pub get. again add and pub get. (Working perfect for me).

If its work for you then give this answer up vote. Thank you!

Comments

1

use this one on you pubspec.yamal cached_network_image: ^2.0.0-rc.1 or use this one cached_network_image: ^2.0.0-rc let me me know if it works. Thanks.

3 Comments

Thank you. I user ^2.0.0-rc and it is working. Thanks a lot
if you have got the desired output, then just make the upvote and mark it checked, so that it will be helpful for others. Thanks.
github.com/renefloor/flutter_cached_network_image/issues/336 I'm having this issue after change 1.1.3 with 2.0.0.
0

If you are using VSCode and you have added the cached_network_image recently to pubspec.yaml then try to stop your app and run again then it will start work

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.