calculatePadding static method
Calculate padding needed to align to the given boundary
offset
: The current offsetalignment
: The alignment boundary Returns the padding needed to align to the boundary
Implementation
static int calculatePadding(int offset, int alignment) {
if (alignment <= 1) return 0;
final remainder = offset % alignment;
return remainder == 0 ? 0 : alignment - remainder;
}