isPalindrome property

bool get isPalindrome

Checks whether the String is a palindrome.

Example:

String foo = 'Hello World';
bool isPalindrome = foo.isPalindrome; // false;
String foo = 'racecar';
bool isPalindrome = foo.isPalindrome; // true;

Implementation

bool get isPalindrome {
  if (isBlank) {
    return false;
  }
  return this == reverse;
}