how to remove a [ ] symbol from Flutter Strings?

Viewed 48

Can I ask help about my Flutter project, sqflite offline database, which i want to convert String to list, but there some issue: the [ ] symbol still there on List data, the question is, how to remove [ ] symbol from string data?

From:

String data = '[data0, data1, data2]';

to:

String data = 'data0, data2, data2'; 
1 Answers

If you want to remove all [ and ] use .replaceAll

  final result = data.replaceAll("[", "").replaceAll("]", "");

Also you can use Regex

Related