minLength static method

String? Function(dynamic) minLength(
  1. int length, {
  2. String? message,
})

Implementation

static String? Function(dynamic) minLength(int length, {String? message}) {
  return (value) {
    if (value == null || value is! String) return null;

    if (value.length < length) {
      return (message ?? "Must be at least $length characters");
    }
    return null;
  };
}