10/14/1
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:location/location.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
|
||||
// LocationController.dart
|
||||
@@ -26,13 +27,19 @@ class LocationController extends GetxController {
|
||||
|
||||
void startLocationUpdates() async {
|
||||
_locationTimer = Timer.periodic(const Duration(seconds: 20), (timer) async {
|
||||
await getLocation();
|
||||
try {
|
||||
await getLocation();
|
||||
|
||||
await CRUD().post(link: AppLink.addCarsLocationByPassenger, payload: {
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
'latitude': myLocation.latitude.toString(),
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
});
|
||||
await CRUD().post(link: AppLink.addCarsLocationByPassenger, payload: {
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
'latitude': myLocation.latitude.toString(),
|
||||
'longitude': myLocation.longitude.toString(),
|
||||
'status': box.read(BoxName.statusDriverLocation).toString()
|
||||
});
|
||||
} catch (e) {
|
||||
// Handle the error gracefully
|
||||
print('Error during location updates: $e');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class LogOut {
|
||||
box.remove(BoxName.email);
|
||||
box.remove(BoxName.lang);
|
||||
box.remove(BoxName.name);
|
||||
box.remove(BoxName.pasengerID);
|
||||
box.remove(BoxName.passengerID);
|
||||
box.remove(BoxName.phone);
|
||||
box.remove(BoxName.tokenFCM);
|
||||
box.remove(BoxName.tokens);
|
||||
|
||||
Reference in New Issue
Block a user