isValid method

  1. @override
bool isValid(
  1. String? value
)
override

Validation function

Implementation

@override
bool isValid(String? value) {
  final Uri? uri = Uri.tryParse(value!);

  if (uri == null) {
    return false;
  }

  if (scheme != null && scheme != uri.scheme) {
    return false;
  }

  if (host != null && host != uri.host) {
    return false;
  }

  if (port != null && port != uri.port) {
    return false;
  }

  if (path != null && path != uri.path) {
    return false;
  }

  return true;
}