I need to convert List<String>
into a String
in the dart.
I want to extract the value of the list from preferences. I have tried this implementation but it is only giving me the last value.
Future<List<String>> services = SharedPrefSignUp.getSelectedServices();
services.then((onValue){
List<String>servicesList=onValue;
selectServicesText=servicesList.join(",");
});
You can iterate list and concatenate values with StringBuffer
var list = ['one', 'two', 'three'];
var concatenate = StringBuffer();
list.forEach((item){
concatenate.write(item);
});
print(concatenate); // displays 'onetwothree'
}