Media constructor

Media(
  1. Stream<List<int>> stream,
  2. int? length, {
  3. String contentType = 'application/octet-stream',
})

Creates a new Media with a byte stream of length length with a contentType.

When uploading media, length can only be null if ResumableUploadOptions is used.

Implementation

Media(this.stream, this.length,
    {this.contentType = 'application/octet-stream'}) {
  if (length != null && length! < 0) {
    throw ArgumentError('A negative content length is not allowed');
  }
}