setData method

void setData({
  1. String? userAgent,
  2. String? routingURL,
  3. String? nominatimURL,
})

Configure third-party or self-hosted API endpoints.

Ensure that the request body, parameters, and HTTP method are compatible with the default OpenStreetMap services.

Parameters:

  • nominatimURL: The Nominatim server URL. Default: https://nominatim.openstreetmap.org

  • routingURL: The routing service URL used to fetch routes (polylines). Default: https://router.project-osrm.org/route/v1/driving

  • userAgent: The User-Agent string to send in request headers to the Nominatim server.

Implementation

void setData({
  String? userAgent,
  String? routingURL,
  String? nominatimURL,
}) {
  if (userAgent != null) _userAgent = userAgent;
  if (nominatimURL != null && nominatimURL != BaseURL.nominatim) {
    _nominatimURL = UrlModel(url: nominatimURL, isCustom: true);
  }
  if (routingURL != null && routingURL != BaseURL.routing) {
    _routingURL = UrlModel(url: routingURL, isCustom: true);
  }
}