validateName static method

String? validateName(
  1. String? value
)

Validates a name. Returns null if valid, otherwise an error message.

Implementation

static String? validateName(String? value) {
  if (value == null || value.isEmpty) return 'Name is required';
  if (value.length < 2) return 'Name must be at least 2 characters';
  return null;
}