alignDownTo method

ByteConverter alignDownTo(
  1. int alignment
)

Aligns down to the specified alignment.

Implementation

ByteConverter alignDownTo(int alignment) {
  if (alignment <= 0) throw ArgumentError('Alignment must be positive');
  final bytes = _converter.bytes.toInt();
  final aligned = (bytes ~/ alignment) * alignment;
  return ByteConverter(aligned.toDouble());
}