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);
                       ^
Davrick
  • 301
  • 1
  • 4
  • 13

3 Answers3

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.

Sagar Acharya
  • 3,397
  • 4
  • 12
  • 34
1

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

Swaroop Maddu
  • 4,289
  • 2
  • 26
  • 38
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