readFileDataAsArrayBuffer function

Future<Uint8List?> readFileDataAsArrayBuffer(
  1. File file
)

Reads file as Uint8List.

Implementation

Future<Uint8List?> readFileDataAsArrayBuffer(File file) async {
  final reader = FileReader();
  reader.readAsArrayBuffer(file);
  await Future.any(
      [reader.onLoad.first, reader.onError.first, reader.onAbort.first]);
  var fileData = reader.result as Uint8List?;
  return fileData;
}