numeric static method

String? numeric(
  1. String? value, {
  2. String? message,
})

Validates numeric value

Example:

Validators.numeric('123.45');

Implementation

static String? numeric(String? value, {String? message}) {
  if (value == null || value.isEmpty) return null;
  if (double.tryParse(value) == null) {
    return message ?? 'Please enter a valid number';
  }
  return null;
}