Closed smiesnyrobert closed 1 year ago
are you calling getRoute in another isolate ?
I have just normal button in widget and call it after button click
same problem
upgrade to new version for osrm dart client 0.4.2 contain some fixes
it what i'm using 0.4.2 . have i to add also flutter_osm_plugin in my dependencies?
if you're use another map no need for flutter osm plugin can provide me more code to understand more the issue
DetailSite(
_selectedSite!,
onSite: () async {
Position mPosition =
await _determinePosition();
print(
" MY LOCATION IS: ${mPosition.longitude} + ${mPosition.latitude}");
List
this callback onSite
is called inside isolate or just future ?
Just future void
Ive created clean new project and here is the whole code. I get same error.
import 'package:flutter/material.dart';
import 'package:routing_client_dart/routing_client_dart.dart';
import 'package:testprojekt/MyOSRMManager.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(),
floatingActionButton: FloatingActionButton(
onPressed: getRoute,
child: const Icon(Icons.add),
),
);
}
void getRoute() {
final manager = MyOSRMManager.custom(server: "xxxx");
List<LngLat> waypoints = [
LngLat(lng: 13.388860, lat: 52.517037),
LngLat(lng: 13.397634, lat: 52.529407),
LngLat(lng: 13.428555, lat: 52.523219),
];
manager
.getRoad(
waypoints: waypoints,
geometries: Geometries.polyline,
steps: true,
)
.then((road) => {
print("success"),
});
}
}
pubspec.yml
name: testprojekt
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.19.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
routing_client_dart: ^0.4.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
if you can that you intercept the response usinf dev tools and share it with me if it possible
which response u mean? http response from server?
yeah
{"code":"Ok","routes":[{"geometry":"mfp_I__vpAWBSBE?C?[BUBuALI@O@wAJK@UBMMC?AAKAe@FyBTC@E?IDIDA@M@]BUBSBA?E@E@A@IFWBG@C?WBm@FG@I@aBNG@i@FO@OBaBNG@M@mAFc@@}@Fu@DG?a@B[@qAF}@JA?[D_E`@SBO@ODA@UDA?ODE@GBC?uBNE?OAKCC_@AI]mCCUE[AK[iCUaBAMAMSsAE[k@sE_@_DAMACAKCQGi@AKQuACOKy@E_@G[Gc@]wBw@aFKw@y@mFCMAKIq@?KAQ?KIuDQmHEuB@U@U?OCq@?I?IASAg@ASMaF?OAi@?c@@c@Du@r@cH@U@I@G@I?G~@kJRyBf@uE@KFi@@KPuABMFc@D[@MT_C@QJ{@Ny@Ha@RiAfBuJF]DOh@yAHSf@aADIR_@JS@C@A@CJSWWEECEECOQe@a@CCUQaCkB{@y@GESO?_@?C?C?WIoCGqCAK?[MaEASMgDAi@AQ@YBKf@_ENg@D]T{ABIHm@FY@GBUJk@@IHcA?c@?QAQG]JKDC@ADCHOL]FOFUT{@BKTu@La@\\gANg@L_@DOJ[~@kBP[JSXg@^q@R]Ta@HQR]b@y@^s@Xg@JQHQP_@HQLMLKRIFAL?J@HBFBr@XNH^NHDTJNFTRRJd@LXFB@B?VB@V?N?F@jA@dB","legs":[{"steps":[{"geometry":"mfp_I__vpAWBSBE?C?[BUBuALI@O@wAJK@UBMMC?AAKAe@FyBTC@E?IDIDA@M@]BUBSBA?E@E@A@IFWBG@C?WBm@FG@I@aBNG@i@FO@OBaBNG@M@mAFc@@}@Fu@DG?a@B[@qAF}@JA?[D_E`@SBO@ODA@UDA?ODE@GBC?uBNE?OAKC","maneuver":{"bearing_after":355,"bearing_before":0,"location":[13.388798,52.517033],"type":"depart"},"mode":"driving","driving_side":"right","name":"Friedrichstraße","intersections":[{"out":0,"entry":[true],"bearings":[355],"location":[13.388798,52.517033]},{"out":0,"in":2,"entry":[true,false,false,true],"bearings":[0,90,180,270],"location":[13.38878,52.517149]},{"out":0,"in":2,"entry":[true,true,false,true],"bearings":[0,90,180,270],"location":[13.388643,52.518027]},{"out":0,"in":2,"entry":[true,true,false,true,false],"bearings":[30,90,180,270,315],"location":[13.388544,52.518716]},{"out":0,"in":1,"entry":[true,false,true,false],"bearings":[0,165,180,285],"location":[13.388255,52.520395]},{"out":0,"in":2,"entry":[true,true,false,true],"bearings":[0,45,180,225],"location":[13.388022,52.521758]},{"out":0,"in":1,"entry":[true,false,true],"bearings":[0,180,255],"location":[13.387898,52.52245]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[0,90,180],"location":[13.387799,52.523401]},{"lanes":[{"valid":false,"indications":["none"]},{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]}],"out":0,"in":1,"entry":[true,false,true],"bearings":[0,180,270],"location":[13.387748,52.523877]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[0,90,180],"location":[13.3877,52.524433]},{"out":3,"in":1,"entry":[true,false,false,true],"bearings":[105,165,300,345],"location":[13.387337,52.526239]},{"out":0,"in":2,"entry":[true,false,false,false],"bearings":[0,105,165,255],"location":[13.387283,52.526386]}],"weight":138.3,"duration":135.5,"distance":1136.9},{"geometry":"yer_IeuupAC_@AI]mCCUE[AK[iCUaBAMAMSsAE[k@sE_@_DAMACAKCQGi@AKQuACOKy@E_@G[Gc@]wBw@aFKw@y@mFCMAKIq@?K","maneuver":{"bearing_after":71,"bearing_before":8,"location":[13.387228,52.527168],"modifier":"right","type":"turn"},"mode":"driving","driving_side":"right","name":"Torstraße","intersections":[{"out":0,"in":1,"entry":[true,false,true,true],"bearings":[75,195,255,330],"location":[13.387228,52.527168]},{"out":0,"in":1,"entry":[true,false,true],"bearings":[75,255,345],"location":[13.389147,52.527549]},{"out":0,"in":1,"entry":[true,false,true],"bearings":[75,255,330],"location":[13.391396,52.528032]},{"out":0,"in":2,"entry":[true,true,false,true],"bearings":[75,165,255,345],"location":[13.392444,52.528237]},{"out":0,"in":2,"entry":[true,true,false,true],"bearings":[75,120,255,330],"location":[13.393814,52.528526]},{"out":0,"in":1,"entry":[true,false,true],"bearings":[75,255,345],"location":[13.395724,52.528996]},{"out":0,"in":2,"entry":[true,true,false,true],"bearings":[90,180,255,345],"location":[13.397565,52.529429]}],"weight":124.899999999,"duration":124.899999999,"distance":750.1},{"geometry":"}sr_IevwpA","maneuver":{"bearing_after":0,"bearing_before":86,"location":[13.39763,52.529432],"type":"arrive"},"mode":"driving","driving_side":"right","name":"Torstraße","intersections":[{"in":0,"entry":[true],"bearings":[266],"location":[13.39763,52.529432]}],"weight":0,"duration":0,"distance":0}],"summary":"Friedrichstraße, Torstraße","weight":263.2,"duration":260.4,"distance":1887},{"steps":[{"geometry":"}sr_IevwpAAQ?KIuDQmHEuB@U@U?OCq@?I?IASAg@ASMaF?OAi@?c@@c@Du@r@cH@U@I@G@I?G~@kJRyBf@uE@KFi@@KPuABMFc@D[@MT_C@QJ{@Ny@Ha@RiAfBuJF]DOh@yAHSf@aADIR_@","maneuver":{"bearing_after":85,"bearing_before":0,"location":[13.39763,52.529432],"type":"depart"},"mode":"driving","driving_side":"right","name":"Torstraße","intersections":[{"out":0,"entry":[true],"bearings":[85],"location":[13.39763,52.529432]},{"lanes":[{"valid":true,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight","right"]}],"out":0,"in":2,"entry":[true,true,false,false],"bearings":[90,150,270,330],"location":[13.401337,52.529605]},{"out":0,"in":2,"entry":[true,false,true],"bearings":[90,165,285],"location":[13.401541,52.529618]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[105,195,285],"location":[13.405456,52.529405]},{"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight","right"]}],"out":1,"in":3,"entry":[true,true,true,false],"bearings":[30,105,210,285],"location":[13.409405,52.528711]},{"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight","right"]}],"out":0,"in":2,"entry":[true,true,false],"bearings":[105,165,285],"location":[13.409967,52.528591]},{"lanes":[{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight","right"]}],"out":0,"in":2,"entry":[true,false,false,false],"bearings":[105,165,285,330],"location":[13.410146,52.52855]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[120,210,285],"location":[13.411852,52.528201]}],"weight":203.400000000,"duration":203.400000000,"distance":1275.6},{"geometry":"gdr_Iie{pAJS@C@A@CJSWWEECEECOQ","maneuver":{"bearing_after":133,"bearing_before":133,"location":[13.415405,52.526922],"modifier":"left","type":"turn"},"mode":"driving","driving_side":"right","name":"","intersections":[{"lanes":[{"valid":false,"indications":["left"]},{"valid":false,"indications":["left"]},{"valid":false,"indications":["straight"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight","right"]}],"out":1,"in":3,"entry":[false,true,true,false],"bearings":[30,135,210,315],"location":[13.415405,52.526922]},{"lanes":[{"valid":true,"indications":["left"]},{"valid":true,"indications":["left"]},{"valid":false,"indications":["straight"]},{"valid":false,"indications":["straight"]},{"valid":false,"indications":["straight"]}],"out":0,"in":3,"entry":[true,true,false,false],"bearings":[30,135,210,315],"location":[13.415657,52.52677]}],"weight":12,"duration":12,"distance":60.6},{"geometry":"aer_Iuh{pAe@a@CCUQaCkB{@y@GESO","maneuver":{"bearing_after":26,"bearing_before":32,"location":[13.415945,52.527047],"modifier":"straight","type":"new name"},"mode":"driving","driving_side":"right","name":"Prenzlauer Allee","intersections":[{"lanes":[{"valid":false,"indications":["left"]},{"valid":true,"indications":["straight"]},{"valid":true,"indications":["straight"]}],"out":0,"in":2,"entry":[true,false,false,true],"bearings":[30,120,210,315],"location":[13.415945,52.527047]}],"weight":18.2,"duration":18.2,"distance":177.6},{"geometry":"{mr_Iip{pA?_@?C?C?WIoCGqCAK?[MaEASMgDAi@AQ@YBKf@_ENg@D]T{ABIHm@FY@GBUJk@@IHcA?c@?QAQG]","maneuver":{"bearing_after":85,"bearing_before":28,"location":[13.417166,52.528458],"modifier":"right","type":"turn"},"mode":"driving","driving_side":"right","name":"Prenzlauer Berg","intersections":[{"out":1,"in":2,"entry":[true,true,false,false],"bearings":[30,90,210,315],"location":[13.417166,52.528458]},{"out":1,"in":3,"entry":[false,true,true,false],"bearings":[45,120,225,285],"location":[13.423592,52.528206]},{"out":1,"in":3,"entry":[true,true,false,false],"bearings":[45,105,210,300],"location":[13.423868,52.528136]}],"weight":57,"duration":57,"distance":548.7},{"geometry":"mkr_Iea}pAJKDC@ADCHOL]FOFUT{@BKTu@La@\\gANg@L_@DOJ[~@kBP[JSXg@^q@R]Ta@HQR]b@y@^s@Xg@JQHQP_@HQLMLKRI","maneuver":{"bearing_after":151,"bearing_before":67,"location":[13.424993,52.528068],"modifier":"right","type":"turn"},"mode":"driving","driving_side":"right","name":"Friedenstraße","intersections":[{"out":1,"in":2,"entry":[true,true,false,true],"bearings":[60,150,255,345],"location":[13.424993,52.528068]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[120,225,300],"location":[13.425818,52.52763]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[135,225,315],"location":[13.428041,52.526565]},{"out":0,"in":2,"entry":[true,true,false],"bearings":[135,225,315],"location":[13.429337,52.525737]}],"weight":52.400000000,"duration":52.400000000,"distance":510.1},{"geometry":"_xq_Iac~pAFAL?J@HBFBr@XNH^NHDTJNFTRRJd@LXFB@B?VB","maneuver":{"bearing_after":174,"bearing_before":163,"location":[13.430405,52.524964],"modifier":"straight","type":"new name"},"mode":"driving","driving_side":"right","name":"Platz der Vereinten Nationen","intersections":[{"out":1,"in":2,"entry":[true,true,false],"bearings":[135,180,345],"location":[13.430405,52.524964]}],"weight":20.6,"duration":20.6,"distance":196.6},{"geometry":"mmq_Io~}pA@V?N?F@jA@dB","maneuver":{"bearing_after":267,"bearing_before":189,"location":[13.429678,52.523269],"modifier":"right","type":"continue"},"mode":"driving","driving_side":"right","name":"Platz der Vereinten Nationen","intersections":[{"lanes":[{"valid":false,"indications":["left"]},{"valid":false,"indications":["straight","left"]},{"valid":false,"indications":["straight"]},{"valid":true,"indications":["straight","right"]}],"out":3,"in":0,"entry":[false,false,true,true],"bearings":[15,90,180,270],"location":[13.429678,52.523269]}],"weight":6.9,"duration":6.9,"distance":76.4},{"geometry":"gmq_Imw}pA","maneuver":{"bearing_after":0,"bearing_before":268,"location":[13.428554,52.523239],"type":"arrive"},"mode":"driving","driving_side":"right","name":"Platz der Vereinten Nationen","intersections":[{"in":0,"entry":[true],"bearings":[88],"location":[13.428554,52.523239]}],"weight":0,"duration":0,"distance":0}],"summary":"Torstraße, Friedenstraße","weight":370.5,"duration":370.5,"distance":2845.5}],"weight_name":"routability","weight":633.7,"duration":630.9,"distance":4732.5}],"waypoints":[{"hint":"Uv8JgH9JmoUXAAAABQAAAAAAAAAgAAAAIXRPQYXNK0AAAAAAcPePQQsAAAADAAAAAAAAABAAAABi-gAA_kvMAKlYIQM8TMwArVghAwAA7wr2gjva","distance":4.231521214,"name":"Friedrichstraße","location":[13.388798,52.517033]},{"hint":"5D7dgak9iocGAAAACgAAAAAAAAB3AAAAppONQOodwkAAAAAA8TeEQgYAAAAKAAAAAAAAAHcAAABi-gAAfm7MABiJIQOCbswA_4ghAwAAXwX2gjva","distance":2.795148358,"name":"Torstraße","location":[13.39763,52.529432]},{"hint":"fSoYgP___38fAAAAUQAAACYAAAAeAAAAeosKQlNOX0Jq6iZCjsMGQh8AAABRAAAAJgAAAB4AAABi-gAASufMAOdwIQNL58wA03AhAwQAvxD2gjva","distance":2.226580806,"name":"Platz der Vereinten Nationen","location":[13.428554,52.523239]}]}
Oh sorry for that I found the issue ,it's my bad , I tried to improve current implementation and I forget that compute accept only top function and I moved parseRoad
to mixin
I will fix the issue and I will publish new version sorry again and thnx for your report
just note I test in web and its working fine xD
thats why I doubt at beginning
new version has being published 0.4.3
thanks for fix, good job
Hi, can you please help me with this error?
Iam using this versions:
routing_client_dart: ^0.4.0
flutter_osm_plugin: ^0.53.3
i have this code:
and i get this error
Can u please help? Thank you