tryValidate method

  1. @override
String? tryValidate()
override

Validates the form field value

Implementation

@override
String? tryValidate() {
  final parsedValue = num.tryParse(value);
  final parsedExtra = num.tryParse(extra);
  if (parsedValue == null || parsedExtra == null) return "Not a valid number";
  if (!(parsedValue > parsedExtra)) {
    if (customMessage == null) {
      return buildMessage(ValidatorStrings.gt, attribute, extra);
    }
    return customMessage;
  }
  return null;
}