FileSink class final

A DataSink that streams written chunks to a file on disk. Native platforms only.

Each chunk is appended as it arrives, so memory stays constant — the output never accumulates in RAM. Open it, pass it to an operation, then close it to flush and release the handle.

import 'package:pdf_manipulator/io.dart';

final out = await FileSink.create(File('/path/to/out.pdf'));
try {
  await pdf.merge([a, b], out);
} finally {
  await out.close();
}

Web has no filesystem; this class is exported from package:pdf_manipulator/io.dart (not the main library) so web builds never pull in dart:io.

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

Methods

close() Future<void>
Flushes pending writes and releases the file handle. Idempotent: safe to call more than once (e.g. from a finally plus an error path); the second and later calls are no-ops.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
write(Uint8List chunk) Future<void>
Write a chunk. Called sequentially, never concurrently.
override

Operators

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

Static Methods

create(File file) Future<FileSink>
Opens file for writing, truncating any existing content. Pair every create with a close.