validAge static method

String? validAge({
  1. String? value,
})

Implementation

static String? validAge({String? value}) {
  if (value!.isEmpty) {
    return 'Please Enter your Age';
  } else if (int.parse(value) > 101) {
    return 'Enter Valid Age';
  } else if (!value.isNumericOnly) {
    return 'Enter valid Age';
  } else if (int.parse(value) == 0) {
    return 'Please Enter Age between 1-101';
  }
  return null;
}