Update: 2026-06-30 23:32:14
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:siro_rider/services/geofencing_service.dart';
|
||||
|
||||
class GeoLocation {
|
||||
Future<Position> getCurrentLocation() async {
|
||||
@@ -28,7 +29,16 @@ class GeoLocation {
|
||||
}
|
||||
|
||||
// When we reach here, permissions are granted and we can fetch the location.
|
||||
return await Geolocator.getCurrentPosition(
|
||||
final position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.high);
|
||||
|
||||
// Update Geofences based on the fresh location
|
||||
try {
|
||||
SiroGeofencingService.syncZonesWithServer(position.latitude, position.longitude);
|
||||
} catch (e) {
|
||||
// Ignore errors so it doesn't break the main location flow
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user