isHttpURL function

bool isHttpURL(
  1. dynamic value
)

Returns true if value represents a HTTP or HTTPS URL.

Implementation

bool isHttpURL(dynamic value) {
  if (value == null) return false;
  if (value is Uri) {
    return value.scheme == 'http' || value.scheme == 'https';
  }

  if (value is String) {
    var s = value.trim();
    if (s.isEmpty) return false;
    return s.startsWith('http://') || s.startsWith('https://');
  }

  return false;
}