toBytes method

Uint8List toBytes()

Converts the UUID to a byte array.

Returns:

  • 16-byte array representation of the UUID

The bytes are in big-endian order, suitable for storage or transmission.

Example

final uuid = Uuid.randomUuid();
final bytes = uuid.toBytes();
final restored = Uuid._fromBytes(bytes);
print(uuid == restored); // true

Implementation

Uint8List toBytes() => _toBytes();