toBytes method

List<int> toBytes([
  1. Endian endian = Endian.big
])

Fixed 16-byte encoding, delegating to each Uint64 limb's own (already web-safe) 8-byte encoding.

Implementation

List<int> toBytes([Endian endian = Endian.big]) {
  final out = List<int>.filled(16, 0);
  if (endian == Endian.big) {
    out.setRange(0, 8, _hi.toBytes(Endian.big));
    out.setRange(8, 16, _lo.toBytes(Endian.big));
  } else {
    out.setRange(0, 8, _lo.toBytes(Endian.little));
    out.setRange(8, 16, _hi.toBytes(Endian.little));
  }
  return out;
}