isUrl property

bool get isUrl

Returns true if the string is a valid URL.

Implementation

bool get isUrl {
  final uri = Uri.tryParse(trim());
  return uri != null &&
      (uri.scheme == 'http' || uri.scheme == 'https') &&
      uri.host.isNotEmpty;
}