Dammyololade / flutter_polyline_points

A flutter plugin that's decodes encoded google poly line string into list of geo-coordinates suitable for showing route/polyline on maps
MIT License
105 stars 130 forks source link

Unhandled Exception: Exception: Unable to get route: Response ---> ZERO_RESULTS #106

Closed widiasa closed 1 month ago

widiasa commented 1 month ago

I have updated my plugin to 2.1.0 and change my code to this.

PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
      googleApiKey: Global.apiKey,
      request: PolylineRequest(
        origin: PointLatLng(pickupLat, pickupLong),
        destination: PointLatLng(deliveryLat, deliveryLong),
        mode: TravelMode.walking,
        avoidTolls: true,
        optimizeWaypoints: true
      ),
    );

But I got this error:

E/flutter ( 2624): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Unable to get route: Response ---> ZERO_RESULTS 
E/flutter ( 2624): #0      NetworkUtil.getRouteBetweenCoordinates (package:flutter_polyline_points/src/network_util.dart:59:9)
E/flutter ( 2624): <asynchronous suspension>
E/flutter ( 2624): #1      PolylinePoints.getRouteBetweenCoordinates (package:flutter_polyline_points/flutter_polyline_points.dart:30:20)
E/flutter ( 2624): <asynchronous suspension>
E/flutter ( 2624): #2      ReLandBookingPageState.getPolyline (package:forwarder/pages/booking/reland_booking_page.dart:1211:29)
E/flutter ( 2624): <asynchronous suspension>

Have tried to change travel mode to driving, etc but it's not working? Any suggestion, please?

widiasa commented 1 month ago

I have checked carefully about value in pickupLat, pickupLong, deliveryLat, and deliveryLong. And I found some value aren't correct. Closing the issue