validate method

  1. @override
ErrMap<TKey>? validate(
  1. ValMap<TKey> values
)
override

Returns ErrMap containing the error messages for each field depedning on each its value from ValMap.

Implementation

@override
ErrMap<TKey>? validate(ValMap<TKey> values) {
  final masterValue = values.get(master);
  final slaveValue = values.get(slave);

  if (masterValue != slaveValue) {
    return {slave: message};
  } else if (masterValue != null && slaveValue != null) {
    return {slave: null}; // Clear error
  }

  return null;
}