validate method

  1. @override
String? validate(
  1. T? value
)
override

Returns String containing the error message if value is invalid. or null when value is valid.

Implementation

@override
String? validate(T? value) {
  if (value == null) return message;
  if (!validateEmpty) return null;
  if (value is num) return value == 0 ? message : null;
  if (value is bool) return !value ? message : null;
  if (value is String) return value.isEmpty ? message : null;
  return null;
}