isValidGoogleMapsUrl static method

bool isValidGoogleMapsUrl(
  1. String url
)

Validates if a URL is a valid Google Maps URL.

This method checks if the provided URL is a valid Google Maps URL by checking for common Google Maps domain patterns.

Returns true if the URL appears to be a Google Maps URL, false otherwise.

Example usage:

final url = 'https://www.google.com/maps/@37.7749,-122.4194,15z';
final isValid = GoogleMapsUrlExtractor.isValidGoogleMapsUrl(url);
print('Is valid: $isValid');

Implementation

static bool isValidGoogleMapsUrl(String url) {
  final googleMapsPatterns = [
    'google.com/maps',
    'maps.google.com',
    'goo.gl/maps',
    'maps.app.goo.gl',
  ];

  return googleMapsPatterns.any((pattern) => url.contains(pattern));
}