removeAllNotNumber method

String removeAllNotNumber({
  1. List<String> exclude = const [],
})

Implementation

String removeAllNotNumber({List<String> exclude = const []}) {
  final List<String> valid = kNumbersString.toList()..addAll(exclude);
  final StringBuffer buffer = StringBuffer();
  for (int i = 0; i < length; i++) {
    final String character = this[i];
    if (valid.contains(character)) buffer.write(character);
  }
  return buffer.toString();
}