isValidUrl static method

bool isValidUrl(
  1. String url
)

Validates if the given string is a valid URL.

Implementation

static bool isValidUrl(String url) {
  final regex = RegExp(
      r'^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?\$');
  return regex.hasMatch(url);
}