validate method

void validate(
  1. String? newValue
)

Implementation

void validate(String? newValue) {
  final String? _newValue = newValue;

  if (_newValue == null || _newValue.isEmpty) {
    if (isRequired) {
      throw RequiredValueException();
    } else {
      return;
    }
  }

  late T? _decimal;

  try {
    _decimal = doParse(_newValue);
    if (_decimal == null) {
      throw RequiredValueException();
    }
  } catch (e) {
    throw InvalidValueException();
  }
}