uIntValidator static method

String? uIntValidator(
  1. String? uInt
)

uIntValidator returns null if the given uInt is valid.

Implementation

static String? uIntValidator(String? uInt) {
  if (uInt == null || uInt.isEmpty) {
    return ("Cannot be empty");
  }
  if (!RegExp(r'^[0-9]+$').hasMatch(uInt) && (uInt).isNotEmpty) {
    return ("Only a positive integer number is allowed");
  }
  return (null);
}