optimized

This commit is contained in:
Mohamed Nouffer
2023-10-06 16:25:21 +05:30
parent 7fdb6c05ee
commit 0e2a8f89f3
101 changed files with 50948 additions and 4137 deletions

View File

@ -1,27 +1,22 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:rogapp/utils/const.dart';
class TrackingService {
static Future<Map<String, dynamic>> addTrack(String userId, double lat, double lon) async {
static Future<Map<String, dynamic>> addTrack(
String userId, double lat, double lon) async {
Map<String, dynamic> cats = {};
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/track/';
print('++++++++$url');
//print('++++++++$url');
final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}';
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'user_id': userId,
'geom': geom
}),
body: jsonEncode(<String, String>{'user_id': userId, 'geom': geom}),
);
if (response.statusCode == 200) {
@ -29,5 +24,4 @@ class TrackingService {
}
return cats;
}
}
}