isURL method

bool isURL(
  1. String value
)

Implementation

bool isURL(String value) {
  const urlPattern =
      r'^(https?:\/\/)?(((([a-zA-Z]|\d|[!#$&-;=?-_]|%[0-9a-fA-F][0-9a-fA-F])+\.)+[a-zA-Z]{2,}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[([a-fA-F\d:.]+)\])(:\d+)?(\/[!#$&-;=?-_]+)*\/?)$';
  final result = RegExp(urlPattern).hasMatch(value);
  return result;
}