numbersOnly property
String
get
numbersOnly
Removes all characters except digits (0-9).
Example:
String text = 'abc123def456';
String numbers = text.numbersOnly; // '123456'
Implementation
String get numbersOnly => replaceAll(RegExp(r'[^0-9]'), '');