I am using flutter printing library to make selected images as pdf. I have a list and inside that list there are paths of the selected images. Here is the code:
final doc = pw.Document();
for(var i=0;i>selected.length;i++){
Image img=Image.file(File(selected[i]));
ImageProvider image=img.image;
doc.addPage(pw.Page(
build: (pw.Context context) {
return pw.Center(
child: pw.Image(image),
); // Center
})); // Page
}
pw.Image only accepts ImageProvider but i am getting this error:
The argument type 'ImageProvider<Object>' can't be assigned to the parameter type 'ImageProvider'.
How can i solve this problem?