getValhallaRoad method
Implementation
Future<Route> getValhallaRoad(ValhallaRequest request) async {
final jsonHeaderRequest = request.encodeHeader();
final response = await dio.get(osmValhallaServer, queryParameters: {
'json': jsonHeaderRequest,
});
if (response.statusCode != null && response.statusCode! > 299 ||
response.statusCode! < 200) {
throw Exception("cannot get route");
}
return compute<Response<dynamic>, Route>(
(response) async {
final Map<String, dynamic> responseJson = response.data;
final valhallaResp = ValhallaResponse.fromJson(responseJson);
return valhallaResp.toRoute();
},
response,
);
}