Home > Net >  Receiving type cast error when selecting file from library using the FilePicker package
Receiving type cast error when selecting file from library using the FilePicker package

Time:01-05

I am creating an app that uses enter image description here

I'm stumped since it would have worked in earlier versions I think. Thanks for the responses. Please let me know if I must include more code.

EDIT*: I have tried using FileImage instead of AssetImage and get a different cast type error:

The argument type 'PlatformFile?' can't be assigned to the parameter type 'File'.

CodePudding user response:

the problem is that you're using AssetImage, which reads images from your code and not the Device's storage. you should be using FileImage:

image: DecorationImage(
  fit: BoxFit.cover,
  image: FileImage(image),
),
  •  Tags:  
  • Related