Reputation: 11
I tried to split a list into letters but the list comes into like this:
['a,b,c,d,e']
what i want is to get eacyh letter with quotation mark like this:
["a","b","c","d"]
what i tried is this:
void main() {
printName("my school book");
}
void printName(String name){
final y =[name.split('')];
y.shuffle();
print('$y');
}
Upvotes: 1
Views: 37
Reputation: 31219
If you want to add quotation marks around each letter after the split, you can do something like this:
void main() {
List<String> letters = [..."abcde".split('').map((letter) => '"$letter"')];
print(letters); // ["a", "b", "c", "d", "e"]
}
Upvotes: 1