reverse string flutter code example
Example: dart reverse a string
// Library approach
String solution1(str) {
return str.split('').reversed.join('');
}
// With runes
String solution(String str) => str.runes.toList().reversed.map((e) => String.fromCharCode(e)).join('');
// DIY approach
String solution(str) {
String reversed = "";
for(var i =str.length-1; i>=0; i--)
reversed+=str[i];
return reversed;
}