readAsBytes method
Reads the File
and returns the content as bytes.
Implementation
Future<Uint8List> readAsBytes() async {
final Completer<Uint8List> completer = Completer<Uint8List>();
final FileReader reader = FileReader();
// final ProgressEvent event =
// await EventStreamProviders.loadEvent.forTarget(reader).first;
void changeEventListener(Event e) async {
final ByteBuffer byteBuffer = (reader.result as JSArrayBuffer).toDart;
completer.complete(byteBuffer.asUint8List());
}
reader.addEventListener('load', changeEventListener.toJS);
reader.readAsArrayBuffer(this);
return completer.future;
}