Closed ghost closed 2 years ago
Hello. I'm getting the following error when doing a matrixPost with metrics different from the default ['duration']
TimeDistanceMatrix distanceMatrix = await client.matrixPost(locations: cities, metrics: ['distance'], units: 'm');
Do you have any idea why this happens? The request works OK in Postman, why is this happening in Flutter Dart? How can I fix it?
Error: OpenRouteServiceException: Expected a value of type 'List<dynamic>', but got one of type 'Null'; Matrix value can't be determined for given inputs, as per https://openrouteservice.org/dev/#/api-docs/v2/matrix/{profile}/post, at url https://api.openrouteservice.org/v2/matrix/driving-car at Object.throw_ [as throw] (http://localhost:3277/dart_sdk.js:5080:11) at ORSMatrix$124matrixPost (http://localhost:3277/packages/open_route_service/src/open_route_service_base.dart.lib.js:1087:21) at ORSMatrix$124matrixPost.next (<anonymous>) at http://localhost:3277/dart_sdk.js:40641:33 at _RootZone.runUnary (http://localhost:3277/dart_sdk.js:40511:59) at _FutureListener.thenAwait.handleValue (http://localhost:3277/dart_sdk.js:35438:29) at handleValueCallback (http://localhost:3277/dart_sdk.js:35999:49) at _Future._propagateToListeners (http://localhost:3277/dart_sdk.js:36037:17) at [_completeWithValue] (http://localhost:3277/dart_sdk.js:35872:23) at async._AsyncCallbackEntry.new.callback (http://localhost:3277/dart_sdk.js:35906:35) at Object._microtaskLoop (http://localhost:3277/dart_sdk.js:40778:13) at _startMicrotaskLoop (http://localhost:3277/dart_sdk.js:40784:13) at http://localhost:3277/dart_sdk.js:36261:9
Hmmm just seems like a issue of making the list nullable. Will diagnose this in a few hours.
@Dhi13man I tried finding out what's wrong but I keep getting the same error. It doesn't make sense, the list of locations I pass isn't null, it's in correct type and everything. Tried everything. metris ['distance'] causes the problem but can't find out why. I run it again and this time the same error is thrown at a different line:
Error: OpenRouteServiceException: Expected a value of type 'List
Please let me know if there is anything I could do to help you troubleshoot it, I need it fixed for my project. Thanks.
Checking now.
Please fork and test the branch 12-error-when-running-matrixpost-with-metrics-distance. The Issue should be resolved there. If everything works fine, will deploy new version with fix.
Please fork and test the branch 12-error-when-running-matrixpost-with-metrics-distance. The Issue should be resolved there. If everything works fine, will deploy new version with fix.
Yes, it works!!! No error and I get the response I wanted. Everything seems okay. Thank you so much for the quick fix!
Hello. I'm getting the following error when doing a matrixPost with metrics different from the default ['duration']
TimeDistanceMatrix distanceMatrix = await client.matrixPost(locations: cities, metrics: ['distance'], units: 'm');
Do you have any idea why this happens? The request works OK in Postman, why is this happening in Flutter Dart? How can I fix it?Error: OpenRouteServiceException: Expected a value of type 'List<dynamic>', but got one of type 'Null'; Matrix value can't be determined for given inputs, as per https://openrouteservice.org/dev/#/api-docs/v2/matrix/{profile}/post, at url https://api.openrouteservice.org/v2/matrix/driving-car at Object.throw_ [as throw] (http://localhost:3277/dart_sdk.js:5080:11) at ORSMatrix$124matrixPost (http://localhost:3277/packages/open_route_service/src/open_route_service_base.dart.lib.js:1087:21) at ORSMatrix$124matrixPost.next (<anonymous>) at http://localhost:3277/dart_sdk.js:40641:33 at _RootZone.runUnary (http://localhost:3277/dart_sdk.js:40511:59) at _FutureListener.thenAwait.handleValue (http://localhost:3277/dart_sdk.js:35438:29) at handleValueCallback (http://localhost:3277/dart_sdk.js:35999:49) at _Future._propagateToListeners (http://localhost:3277/dart_sdk.js:36037:17) at [_completeWithValue] (http://localhost:3277/dart_sdk.js:35872:23) at async._AsyncCallbackEntry.new.callback (http://localhost:3277/dart_sdk.js:35906:35) at Object._microtaskLoop (http://localhost:3277/dart_sdk.js:40778:13) at _startMicrotaskLoop (http://localhost:3277/dart_sdk.js:40784:13) at http://localhost:3277/dart_sdk.js:36261:9