isValid<TModel> method

  1. @override
bool isValid<TModel>(
  1. String value,
  2. TModel model
)
override

Verify if the model is valid compared to the current validator You must add value parameter, this one is your current property to validate. model parameter is also required, even if your custom validator won't use it. It reprensents your full object model with all values. Maybe you would validate a property in comparison to others.

Implementation

@override
bool isValid<TModel>(String value, TModel model) {
  try {
    bool isValid = _validate(value);
    return isValid;
  } catch (e) {
    print(e);
    return false;
  }
}