readFile method

  1. @override
Stream<Uint8List> readFile(
  1. String filePath, {
  2. String? mediaType,
})
override

Retrieves binary data stream from storage at the specified file path

filePath - Path of the file to read

Returns a stream of binary data

Implementation

@override
Stream<Uint8List> readFile(String filePath, {String? mediaType}) async* {
  final file = _fileFor(filePath);
  if (!await file.exists()) {
    throw FileSystemException('File does not exist', filePath);
  }
  final source = file.openRead();
  await for (final chunk in source) {
    yield chunk is Uint8List ? chunk : Uint8List.fromList(chunk);
  }
}