numeric static method

String? Function(dynamic) numeric({
  1. String message = "Must be a number",
})

Implementation

static String? Function(dynamic) numeric({
  String message = "Must be a number",
}) {
  return (value) {
    if (value == null || value.toString().isEmpty) {
      return null; // Optional unless required
    }
    if (num.tryParse(value.toString()) == null) return message;
    return null;
  };
}