dropRightWhile method

String dropRightWhile(
  1. bool condition(
    1. String
    )
)

Drop right while the condition is met.

Implementation

String dropRightWhile(bool Function(String) condition) {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  if (this!.isEmpty) {
    return '';
  }
  var index = this!.length - 1;
  while (index >= 0 && condition(this![index])) {
    index--;
  }
  return this!.substring(0, index + 1);
}