readBytes method

Future<Uint8List> readBytes()

Returns bytes of the html file.

Implementation

Future<Uint8List> readBytes() async {
  final Completer<List<int>> bytesFile = Completer<List<int>>();
  final FileReader reader = FileReader();
  reader.onLoad.listen(
      (event) => bytesFile.complete(reader.result as FutureOr<List<int>>?));
  reader.readAsArrayBuffer(this);
  return Uint8List.fromList(await bytesFile.future);
}