trimStringRight method
Trim only the right side with a specific string.
Specify the character string to be trimmed in chars
.
Implementation
String trimStringRight(String chars) {
final pattern = chars.isNotEmpty ? RegExp("[$chars]+\$") : RegExp(r"\s+$");
return replaceAll(pattern, "");
}