How to convert a String to an array of char in Dart ?
I’ve tried to cast a String to a List of char and it didn’t work
>Solution :
Loop through the string, and assign each character to the end of a List. Please mark my answer as accepted. Code is given below:
void main() {
String str = 'This is a string.';
List charStr = [];
for(var i=0; i<str.length; i++ ) {
charStr.add(str[i]);
}
print(charStr);
}