BinaryWriterNumeric extension

Fixed-width numeric writing methods for BinaryWriter.

Writes primitive types at their natural, fixed size. All multi-byte integers use configurable endianness (defaults to big-endian).

Type sizes:

  • bool: 1 byte (0 or 1)
  • Uint8/Int8: 1 byte
  • Uint16/Int16: 2 bytes
  • Uint32/Int32: 4 bytes
  • Uint64/Int64: 8 bytes
  • Float32: 4 bytes (IEEE 754)
  • Float64: 8 bytes (IEEE 754)

Example:

writer.writeBool(true);
writer.writeUint32(0x12345678);
writer.writeFloat64(3.14, Endian.little);
on

Methods

writeBool(bool value) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a boolean value as a single byte.
writeFloat32(double value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 32-bit floating-point number (IEEE 754 single precision).
writeFloat64(double value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 64-bit floating-point number (IEEE 754 double precision).
writeInt16(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 16-bit signed integer (-32768 to 32767).
writeInt32(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 32-bit signed integer (-2,147,483,648 to 2,147,483,647).
writeInt64(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 64-bit signed integer.
writeInt8(int value) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes an 8-bit signed integer (-128 to 127).
writeUint16(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 16-bit unsigned integer (0-65535).
writeUint24(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 24-bit unsigned integer (0 to 16,777,215).
writeUint32(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 32-bit unsigned integer (0 to 4,294,967,295).
writeUint64(int value, [Endian endian = .big]) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes a 64-bit unsigned integer.
writeUint8(int value) → void

Available on BinaryWriter, provided by the BinaryWriterNumeric extension

Writes an 8-bit unsigned integer (0-255).