Dart – Concatenate a String with itself Multiple Times

To concatenate a string with itself multiple times in Dart, use Multiplication Operator * and pass the string and the integer as operands to it.


The syntax to concatenate a string str with itself n number of times is

str * n


In this example, we take a string 'apple' with concatenate this string with itself 4 times.


void main() {
  var str = 'banana';
  var result = str * 4;
  print('Original String : "$str"');
  print('Result String   : "$result"');


Original String : "banana"
Result String   : "bananabananabananabanana"


In this Dart Tutorial, we learned how to concatenate a string with itself multiple number of times, with examples.