createReadStream method
Return file contents as readonly stream. Caller should dispose stream when complete.
Implementation
@override
Stream<dynamic> createReadStream() {
// For VM platforms
final ioFile = _ioFile;
if (ioFile != null) {
return ioFile.openRead();
}
// For web platforms, we need to read the entire file and emit it
// as a stream. This is less efficient than a true stream, but works
// cross-platform.
return Stream.fromFuture(_file.readAsBytes())
.map((bytes) => bytes as dynamic);
}