LyStringIsURL class

Validation that requires a string to be an URL.

If the value is not an URL, the message is returned.

Example:

final validator = StringIsUrl('Invalid URL');
final result = validation('https:/www.google.com');
print(result); // Invalid URL

Constructors

LyStringIsURL(String message, {List<String?> protocols = const ['http', 'https', 'ftp'], bool requireTld = true, bool requireProtocol = false, bool allowUnderscore = false, List<String> hostWhitelist = const [], List<String> hostBlacklist = const []})
Validation that requires a string to be an URL.

Properties

allowUnderscore bool
Whether to allow underscores in hostnames.
final
hashCode int
The hash code for this object.
no setterinherited
hostBlacklist List<String>
The hostname blacklist.
final
hostWhitelist List<String>
The hostname whitelist.
final
message String
finalinherited
protocols List<String?>
The protocols to allow.
final
requireProtocol bool
Whether to require a protocol.
final
requireTld bool
Whether to require a top-level domain.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(String value) String?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator &(LyBaseValidator<String> other) → LyBaseValidator<String>
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator |(LyBaseValidator<String> other) → LyBaseValidator<String>
inherited