validateOne method

bool validateOne(
  1. int index,
  2. String? validator(
    1. int index
    )
)

Validates a single item using the provided validator function.

Returns true if the item is valid, false otherwise.

Implementation

bool validateOne(int index, String? Function(int index) validator) {
  final error = validator(index);
  setError(index, error);
  return error == null || error.isEmpty;
}