streamAt method

  1. @override
Future<DataStream> streamAt(
  1. String path
)
override

Returns the data stream for the contents at the given relative path.

Implementation

@override
Future<DataStream> streamAt(String path) async {
  String? filePath = files[path];
  if (filePath == null) {
    throw ContainerException.resourceNotFound(path);
  }
  File file = File(filePath);
  if (!await file.exists()) {
    throw ContainerException.fileNotFound(path);
  }

  return FileStream.fromFile(file);
}