Files
rog_app/lib/services/maxtrix_service.dart

48 lines
1.2 KiB
Dart
Raw Normal View History

2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// import 'dart:convert';
// import 'package:http/http.dart' as http;
// import 'package:rogapp/model/destination.dart';
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// class MatrixService{
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// String locs = "";
// String origin = "";
// int i = 0;
// for(Destination d in destinations){
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// print("---- getting matrix for ${d} ------------");
2022-07-10 23:50:43 +05:30
2022-12-13 18:19:16 +05:30
// if(i==0){
// origin = "${d.lat}, ${d.lon}";
// }
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// print("lat is ${d.lat}, long is ${d.lon}");
// locs += "${d.lat}, ${d.lon}|";
// i++;
// }
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// //print(locs);
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// Map<String, dynamic> cats = {};
// String url = "https://maps.googleapis.com/maps/api/distancematrix/json?destinations=${locs}&origins=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
// print(url);
// final http.Response response = await http.get(
// Uri.parse(url),
// headers: <String, String>{
// 'Content-Type': 'application/json; charset=UTF-8',
// }
// );
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// if (response.statusCode == 200) {
// cats = json.decode(utf8.decode(response.bodyBytes));
// }
// return cats;
// }
2022-05-18 19:09:26 +05:30
2022-12-13 18:19:16 +05:30
// }
2022-05-18 19:09:26 +05:30