padToWidth method
Pads this string to width with padChar, on the left if padLeft else right.
Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
String padToWidth(int width, {bool padLeft = true, String padChar = ' '}) {
if (length >= width) return this;
final String pad = padChar * (width - length);
return padLeft ? pad + this : this + pad;
}