Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert a List<String> to String []?

Tags:

flutter

dart

I have this String

List<String> params = ['A','B','C'];

I want to convert this to "['A']['B']['C']" How can I convert this properly?

like image 696
SK- Avatar asked Feb 25 '26 01:02

SK-


1 Answers

You can try:

void main(){
  List<String> params = ['A','B','C'];
  final out = params.map((e) => "['$e']").join();
  print(out);
}

Prints:

['A']['B']['C']
like image 121
MendelG Avatar answered Feb 26 '26 23:02

MendelG



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!