Open ds797 opened 5 months ago
The format
argument in Reader.getFile
is nullable. You should be able to call the method with null
format which should give you any file in the clipboard.
Reader.getFile
return null if the format
argument is null.
It seems that the package does not provide compound formats like Formats.image
, but adding entries manually works out:
final imageFormat = SimpleFileFormat(
uniformTypeIdentifiers: ['public.jpeg', 'public.png'],
windowsFormats: ['JFIF', 'PNG'],
mimeTypes: ['image/jpeg', 'image/png'],
);
Now the imageFormat
refers to gif
and jpg
at the same time, which can be used at reading files with multiple possible formats:
reader.getFile(imageFormat, (file) async {
final data = await file.readAll();
// Do sth with data...
}
I wonder if the package could provide easy declarations for compound formats🤔
Things like these would be much more convenient:
final imageFormat = Formats.png | Formats.jpeg | Formats.webp | Formats.bmp;
... or add something like Formats.any
to read any file as stream / bytes?
Is it possible to ignore format and get any image data as Uint8List?