repeat method

String? repeat(
  1. int count
)

Repeats the String count times.

Example

String foo = 'foo';
String fooRepeated = foo.repeat(5); // 'foofoofoofoofoo'

Implementation

String? repeat(int count) {
  if (this.isBlank || count <= 0) {
    return this;
  }
  var repeated = this!;
  for (var i = 0; i < count - 1; i++) {
    repeated += this!;
  }
  return repeated;
}