readBytes method Null safety

Future<Uint8List> readBytes(
  1. int size
)

Read bytes into a Uint8List.

This does the same as readChunk, except it uses collectBytes to create a Uint8List, which offers better performance.

Implementation

Future<Uint8List> readBytes(int size) async =>
    await collectBytes(readStream(size));