isPalindrome method
Check if a string reads the same forward and backward.
Implementation
bool isPalindrome() {
String cleaned = toLowerCase().replaceAll(RegExp(r'\s+'), '');
return cleaned == cleaned.split('').reversed.join('');
}
Check if a string reads the same forward and backward.
bool isPalindrome() {
String cleaned = toLowerCase().replaceAll(RegExp(r'\s+'), '');
return cleaned == cleaned.split('').reversed.join('');
}