stopriding method Null safety
tells the server to calculate the las ride
Implementation
Future<int> stopriding() async {
Response response;
try {
response = await post(
Uri.parse(
'http://$_server:$_port/coordinates/calculateDistance?tour_id=1'),
headers: {
"accept": "application/json",
"Authorization": "Bearer $_accesstoken"
});
} catch (e) {
return 503;
}
if (response.statusCode == 401) {
getlogintoken(_username, _password).then((value) async {
response = await post(
Uri.parse(
'http://$_server:$_port/coordinates/calculateDistance?tour_id=1'),
headers: {
"accept": "application/json",
"Authorization": "Bearer $_accesstoken"
});
});
}
_tourNumber = 0;
return response.statusCode;
}