padRight method

String padRight(
  1. int width, [
  2. String padding = ' '
])

Pads the string on the right to the specified width.

Example:

'5'.padRight(3, '0'); // '500'

Implementation

String padRight(int width, [String padding = ' ']) {
  assert(width >= 0, 'width must be non-negative');
  return length >= width ? this : this + padding * (width - length);
}