isUrl top-level property

Matcher isUrl
final

Asserts that a String is an http:// or https:// URL.

The regular expression used:

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)

Implementation

final Matcher isUrl = predicate(
    (dynamic value) => value is String && _url.hasMatch(value),
    'a valid url, starting with http:// or https://');