calculateDistance method
Implementation
Future<Distance> calculateDistance(DistanceRequest distanceRequest) async {
final result = await http.post(
Uri.parse(calculateDistanceURL),
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"api-key": apikey,
},
body: jsonEncode(distanceRequest.toMap()),
);
var convertDataToJson = jsonDecode(result.body);
return Distance.fromMap(convertDataToJson);
}