liodali / OSM-Routing-Client-Dart

flutter package for osrm client api and open source routing service
https://pub.dev/packages/routing_client_dart
MIT License
18 stars 12 forks source link

Error of type in duration variable on parseRoad #1

Closed renehw closed 2 years ago

renehw commented 2 years ago

Hi, I found an error in your package, when I pass the coordinates for the getRoad() an error is throw on line 41 and 43 of utils.dart, the duration variable get a value double but the type is int and throws the error type 'double' is not a subtype of type 'int' in type cast .

exemplo 1

exemplo 2

[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [versão 10.0.19042.1348], locale pt-BR) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)

liodali commented 2 years ago

ok i will fix that

liodali commented 2 years ago

check the new version 0.1.1

renehw commented 2 years ago

Your update solved the problem, thank you!

renehw commented 2 years ago

Hi @liodali , I am implemanting trip service but I have a problem with type of variable.

E/flutter ( 5881): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Exception: type 'int' is not a subtype of type 'double' in type cast
E/flutter ( 5881): #0      new Road.fromOSRMJson
package:routing_client_dart/…/models/road.dart:43
E/flutter ( 5881): #1      parseTrip
package:routing_client_dart/…/utilities/utils.dart:88
E/flutter ( 5881): #2      _IsolateConfiguration.apply
package:flutter/…/foundation/_isolates_io.dart:83
E/flutter ( 5881): #3      _spawn.<anonymous closure>
package:flutter/…/foundation/_isolates_io.dart:90
E/flutter ( 5881): #4      _spawn.<anonymous closure>
package:flutter/…/foundation/_isolates_io.dart:89
E/flutter ( 5881): #5      Timeline.timeSync (dart:developer/timeline.dart:163:22)
E/flutter ( 5881): #6      _spawn
package:flutter/…/foundation/_isolates_io.dart:87
E/flutter ( 5881): #7      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17)
E/flutter ( 5881): #8      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter ( 5881):

image

Att.

liodali commented 2 years ago

ok i will fix that

liodali commented 2 years ago

check 0.3.0+1

renehw commented 2 years ago

Your update solved the problem, thank you!

renehw commented 2 years ago

But, how use the road response with drawRoadManually? Because drawRoadManually need a List<GeoPoint> and the getTrip don't return this.

liodali commented 2 years ago

i will add extension for GeoPoint that will transform the attribute polylineEncoded to geoPoint List it will be available tomrrow at max

liodali commented 2 years ago

check the new version in flutter_osm 0.30.1 for string use this method toListGeo is extension for string to convert encodedPolylines to List of GeoPoint example :

 final list = await routeEncoded.toListGeo();
renehw commented 2 years ago

Thanks man, I will test!