onlyNumberString static method

String onlyNumberString({
  1. required String text,
})

Implementation

static String onlyNumberString({required String text}) {
  final regexp = RegExp(r'\D');
  var onlySanitized = text.replaceAll(regexp, '');
  return onlySanitized.replaceAll('.', '').replaceAll('/', '').replaceAll('-', '');
}