Read and write
import 'package:dartarrow/arrow.dart' as pa;
import 'package:dartarrow/ipc.dart' as ipc;
final table = pa.table({'id': pa.array([1, 2], type: pa.int64())});
final stream = (ipc.newStream(table.schema)..writeTable(table)).close();
final restored = ipc.openStream(stream).readAll(); // Table
final file = (ipc.newFile(restored.schema)..writeTable(restored)).close();
final reader = ipc.openFile(file);
reader.numRecordBatches;
reader.getBatch(0);
| Returns | Main members | |
|---|---|---|
openStream | RecordBatchStreamReader | schema, readNextBatch() (null at end), readAll() |
openFile | RecordBatchFileReader | schema, numRecordBatches, getBatch(i), readAll() |
newStream, newFile | writers | writeBatch, writeTable, write, close() (returns the bytes) |
I/O is in memory (Uint8List); file access is left to the caller. Uncompressed bodies are read zero-copy, so keep the input bytes alive and unmodified. All standard Arrow types round-trip, including nested dictionaries, dictionary deltas and extension annotations. See example/arrow_ipc.dart.
Compression
| Platform | LZ4_FRAME read | ZSTD read | Write |
|---|---|---|---|
| Dart VM | yes | yes | uncompressed |
| Web (dart2js) | yes | unsupported | uncompressed |
The web LZ4 decoder bounds-checks its input but does not verify frame checksums. External LZ4 dictionaries are unsupported.
Limits
- Little-endian only. Big-endian input raises
UnsupportedError. IpcLimitsbounds depth, fields, rows, buffers, message size, dictionaries and batches. Defaults are conservative; raise them for large trusted input.- Malformed input raises
FormatException. Unknown codecs or types raiseUnsupportedError. bindingInt128()andbindingUint128()cannot be written.- Extension metadata must be UTF-8. Other metadata is preserved as raw bytes.
Verification
PyArrow 26.0.0 stream and file fixtures in test/conformance/fixtures/arrow_ipc/ are read by Dart without Python. Dart-written output is read back and validated by PyArrow in CI. See CONTRIBUTING.md to run it.