trySetValue method

bool trySetValue(
  1. T candidate
)

Sets value to candidate only when it passes validation.

Implementation

bool trySetValue(T candidate) {
  if (validationErrorFor(candidate) != null) return false;
  value = candidate;
  return true;
}