FileBlock class final

A Block view backed by a dart:io File.

The file length is captured when the block is opened. Callers must treat the source file as immutable for the lifetime of the block.

Implemented types

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
The size in bytes.
no setteroverride
type → String
The media type.
no setteroverride

Methods

arrayBuffer() → Future<Uint8List>
Returns all bytes.
ensureMaterialized() → Future<FileBlock>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readRange(int offset, int length) → Future<Uint8List>
slice(int start, [int? end, String? contentType]) → Block
Returns a new Block containing bytes from start (inclusive) to end (exclusive), using Blob-compatible index normalization.
override
stream({int chunkSize = Block.defaultStreamChunkSize}) → Stream<Uint8List>
Streams bytes in chunks.
text() → Future<String>
Returns UTF-8 decoded text.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

open(File file, {String type = ''}) → Future<FileBlock>
Opens an entire file as a lazy, file-backed Block.
openRange(File file, {required int offset, required int length, String type = ''}) → Future<FileBlock>
Opens a byte range of file as a lazy, file-backed Block.