isEquals method
Returns true if this string equals other, with options for
case-insensitivity via ignoreCase and apostrophe normalization via
normalizeApostrophe.
Implementation
@useResult
bool isEquals(
String? other, {
bool ignoreCase = true,
bool normalizeApostrophe = true,
}) {
if (other == null) {
return false;
}
String first = this;
String second = other;
if (ignoreCase) {
first = first.toLowerCase();
second = second.toLowerCase();
}
if (normalizeApostrophe) {
first = first.replaceAll(_apostropheRegex, "'");
second = second.replaceAll(_apostropheRegex, "'");
}
return first == second;
}