// import 'dart:convert'; // import 'package:flutter_polyline_points/flutter_polyline_points.dart'; // //import 'package:google_maps_webservice/directions.dart'; // import 'package:http/http.dart' as http; // import 'package:rogapp/model/destination.dart'; // import '../utils/const.dart'; // class DestinationService{ // static Future> getDestinations(int user_id) async { // List cats = []; // String server_url = ConstValues.currentServer(); // String url = "${server_url}/api/destinations/?user_id=${user_id}"; // //String url = "http://localhost:8100/api/destinations/?user_id=${user_id}"; // final http.Response response = await http.get( // Uri.parse(url), // headers: { // 'Content-Type': 'application/json; charset=UTF-8', // } // ); // if (response.statusCode == 200) { // cats = json.decode(utf8.decode(response.bodyBytes)); // } // return cats; // } // static Future> deleteDestination(int dest_id) async { // Map cats = {}; // String server_url = ConstValues.currentServer(); // String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}"; // //String url = "http://localhost:8100/api/delete_destination/?dest_id=${dest_id}"; // final http.Response response = await http.get( // Uri.parse(url), // headers: { // 'Content-Type': 'application/json; charset=UTF-8', // } // ); // if (response.statusCode == 200) { // cats = json.decode(utf8.decode(response.bodyBytes)); // } // print("####### ---- ${cats}"); // return cats; // } // static Future updateOrder(int action_id, int order, String dir) async { // int cats = 0; // String server_url = ConstValues.currentServer(); // String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; // print("---- url is ${url} -----"); // //String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; // final http.Response response = await http.get( // Uri.parse(url), // headers: { // 'Content-Type': 'application/json; charset=UTF-8', // } // ); // if (response.statusCode == 200) { // cats = json.decode(utf8.decode(response.bodyBytes)); // } // return cats; // } // static Future>? getDestinationLine(List destinations) async{ // PolylinePoints polylinePoints = PolylinePoints(); // if(destinations.length <= 0){ // return []; // } // //print("##### @@@@@ ${destinations[0].lat}"); // PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!); // PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!); // List wayPoints = []; // int i=0; // for(dynamic d in destinations){ // if(i == 0 || i == (destinations.length -1)){ // i+=1; // continue; // } // double la = d.lat; // double ln = d.lon; // PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: true); // //print("----- UUUUUU ${pwp}"); // //PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]); // wayPoints.add(pwp); // i+=1; // } // //PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186)); // PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: TravelMode.driving, wayPoints: wayPoints); // //print("#####@@@@@ ${result.points}"); // return result.points; // } // }