numericRegex top-level property

RegExp numericRegex
final

Regex to check a string contains only digits Note that spaces are not counted as numeric

For example:

  • numericRegex.hasMatch('402') -> true
  • numericRegex.hasMatch('203k') -> false
  • numericRegex.hasMatch('201.6') -> true

Implementation

final numericRegex = RegExp(r'^[\d.]+$');