Using image_picker to select png files logs an error but the app works fine(the png file gets selected). The error i get
image_picker only supports compression for jpg files
I want to use it for .png files. Can I still use it or not?
Using file_picker package, https://pub.dev/packages/file_picker,(with filter, type: FileType.IMAGE) instead of image_picker package works with .png without logging an error.
I think that using the file_picker plugin would be the best option for this. It is a well developed plugin and easily implemented.
Here is an example implementation that you could use for PNG files only.
List<File> _paths;
FileType _pickingType;
bool _hasVailMime;
Future<List<File>> _openImageFileExplorer() async {
if(_pickingType != FileType.CUSTOM || _hasValidMime){
try {
_paths = await FilePicker.getMultiFile( // Or getFile
type: FileType.CUSTOM, fileExtension: 'png');
}
on PlatformException catch (e){
print("Unsupported operation: " + e.toString());
}
}
return _paths;
}