flutter list to string code example

Example 1: convert a list to string in flutter

List<String> list =["one", "Two", "Thee"];
 print(list.join(","));  // Output will be like this : one,Two,Thee

Example 2: Flutter list of strings to one String

var list = ['one', 'two', 'three'];
  var concatenate = StringBuffer();

  list.forEach((item){
    concatenate.write(item);
  });

  print(concatenate); // displays 'onetwothree'

  }

Example 3: flutter concat string list

list.join("");

Example 4: flutter count list

var comments = <Comment>[...];
var count = comments.where((c) => c.product_id == someProductId).toList().length;