readFileInputElementAsArrayBuffer function
Future<Uint8List?>
readFileInputElementAsArrayBuffer(
- FileUploadInputElement? input, [
- bool removeExifFromImage = false
Reads selected file of input
as Uint8List.
Implementation
Future<Uint8List?> readFileInputElementAsArrayBuffer(
FileUploadInputElement? input,
[bool removeExifFromImage = false]) async {
if (input == null || input.files == null || input.files!.isEmpty) return null;
var file = input.files!.first;
Uint8List? data;
if (removeExifFromImage) {
var dataURL = await removeExifFromImageFile(file);
if (dataURL != null) {
data = DataURLBase64.parsePayloadAsArrayBuffer(dataURL);
}
}
data ??= await readFileDataAsArrayBuffer(file);
return data;
}