AsyncFile class final

Random-access async file with a stable, engine-independent API.

Implemented types
Available extensions

Constructors

AsyncFile.fromBackend(String path, BytesFile backend, {FileOptions options = const FileOptions()})
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
isClosed → bool
no setter
length → Future<int>
no setter
options → FileOptions
final
path → String
final
position → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

append(IoSlice src, {CancelToken? cancel}) → Future<int>
chain(AsyncRead next) → AsyncRead

Available on AsyncRead, provided by the AsyncReadExt extension

Reads this source, then next.
close() → Future<void>
copyTo(AsyncWrite dst, {int bufferSize = 64 * 1024, int? limit}) → Future<int>

Available on AsyncRead, provided by the AsyncReadExt extension

Copies this source into dst, optionally up to limit bytes.
delete() → Future<void>
flush({CancelToken? cancel}) → Future<void>
override
flushWith(Durability durability, {CancelToken? cancel}) → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readAllNative({NativeBufferPool? pool}) → Future<NativeBuffer>

Available on AsyncFile, provided by the AsyncFileNative extension

Reads the whole file into a pooled native buffer.
readAt(int offset, ReadBuf dst, {CancelToken? cancel}) → Future<int>
readExact(ReadBuf dst) → Future<void>

Available on AsyncRead, provided by the AsyncReadExt extension

Fills dst completely or throws UnexpectedEof.
readF32({Endian endian = Endian.big}) → Future<double>

Available on AsyncRead, provided by the AsyncReadExt extension

readF64({Endian endian = Endian.big}) → Future<double>

Available on AsyncRead, provided by the AsyncReadExt extension

readInto(ReadBuf dst) → Future<ReadResult>
override
readIntoNative(int offset, NativeBuffer buffer) → Future<int>

Available on AsyncFile, provided by the AsyncFileNative extension

Reads into a caller-owned native buffer without allocating a Dart buffer.
readMany(List<ReadRequest> requests, {CancelToken? cancel}) → Future<List<int>>
readToEnd({int? limit}) → Future<Bytes>

Available on AsyncRead, provided by the AsyncReadExt extension

Reads until EOF, returning an immutable view over the accumulated data.
readU16({Endian endian = Endian.big}) → Future<int>

Available on AsyncRead, provided by the AsyncReadExt extension

readU32({Endian endian = Endian.big}) → Future<int>

Available on AsyncRead, provided by the AsyncReadExt extension

readU64({Endian endian = Endian.big}) → Future<Uint64>

Available on AsyncRead, provided by the AsyncReadExt extension

readU8() → Future<int>

Available on AsyncRead, provided by the AsyncReadExt extension

take(int limit) → AsyncRead

Available on AsyncRead, provided by the AsyncReadExt extension

Reads at most limit bytes from this source.
toString() → String
A string representation of this object.
inherited
truncate(int newLength, {CancelToken? cancel}) → Future<void>
writeAll(IoSlice src) → Future<void>

Available on AsyncWrite, provided by the AsyncWriteExt extension

Writes all bytes in src, looping over short writes.
writeAt(int offset, IoSlice src, {CancelToken? cancel}) → Future<int>
writeFloat64(double value, {Endian endian = Endian.big}) → Future<void>

Available on AsyncWrite, provided by the AsyncWriteExt extension

writeFrom(IoSlice src) → Future<int>
override
writeFromNative(int offset, NativeBuffer buffer) → Future<int>

Available on AsyncFile, provided by the AsyncFileNative extension

Writes from a caller-owned native buffer.
writeMany(List<WriteRequest> requests, {CancelToken? cancel}) → Future<List<int>>
writeUint16(int value, {Endian endian = Endian.big}) → Future<void>

Available on AsyncWrite, provided by the AsyncWriteExt extension

writeUint32(int value, {Endian endian = Endian.big}) → Future<void>

Available on AsyncWrite, provided by the AsyncWriteExt extension

writeUint64(Uint64 value, {Endian endian = Endian.big}) → Future<void>

Available on AsyncWrite, provided by the AsyncWriteExt extension

writeUint8(int value) → Future<void>

Available on AsyncWrite, provided by the AsyncWriteExt extension

Operators

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

Static Methods

open(String path, {FileOptions options = const FileOptions()}) → Future<AsyncFile>