Home > Software engineering >  can't load the image using the filepicker in flutter
can't load the image using the filepicker in flutter

Time:01-14

final PlatformFile image; final double size;

decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.cover, image: AssetImage(image.path!), ),

CodePudding user response:

you need to used FileImage instead of AssetImage

            decoration: new BoxDecoration(
                color: Colors.transparent,
                image: new DecorationImage(
                  image: new FileImage(File(image.path)),
                  fit: BoxFit.cover,
                ),
        
              ),

CodePudding user response:

Use FileImage instead of AssetImage if you are trying to take from local path.

  •  Tags:  
  • Related