repeat method
Returns this string repeated count times.
Example:
'abc'.repeat(3); // 'abcabcabc'
'x'.repeat(5); // 'xxxxx'
'test'.repeat(0); // ''
Implementation
@useResult
String repeat(int count) {
if (isEmpty || count <= 0) {
return '';
}
final StringBuffer buffer = StringBuffer();
for (int i = 0; i < count; i++) {
buffer.write(this);
}
return buffer.toString();
}