only method

string only(
  1. Iterable<string> chars
)

Removes from string all chars thats not in chars

Implementation

string only(Iterable<string> chars) {
  if (isBlank) {
    return blankIfNull;
  }
  chars = chars.expand((x) => x.split('')).toSet();
  return split('').where((x) => chars.contains(x)).join('');
}