ByteRange class
A range of bytes to download, sent as a Range header.
Both offsets are zero-based and inclusive, so ByteRange(0, 99) asks for
the first 100 bytes. Without an end, the range runs to the end of the
file, which resumes a download that stopped after start bytes.
A download with a range only succeeds when the server answers with status
206 and only those bytes. When a cache in front of it ignores the range and
sends the whole file, the download throws a StorageException instead of
returning it. A start at or past the end of the file fails with a
StorageApiException whose code is InvalidRange.
final firstKilobyte = await storage
.from('videos')
.download('intro.mp4', range: ByteRange(0, 1023));
Constructors
- ByteRange(int start, [int? end])
-
Throws an ArgumentError when
startis negative orendis beforestart.
Properties
- end → int?
-
The offset of the last byte to download, or
nullfor the end of the file.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- start → int
-
The offset of the first byte to download.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited