rightStrip method

String rightStrip([
  1. String? character
])

The string without any trailing whitespace and optional character

Implementation

String rightStrip([String? character]) {
  final String trimmed = trimRight();

  if (character != null && trimmed.endsWith(character)) {
    return trimmed.substring(0, trimmed.length - 1);
  }

  return trimmed;
}