import 'package:geolocator/geolocator.dart'; class LocationAccessService { LocationAccessService._(); static Future getCurrentPosition() async { final enabled = await Geolocator.isLocationServiceEnabled(); if (!enabled) { throw Exception( 'Konum servisleri kapalı. Lütfen cihaz ayarlarından açın.'); } var permission = await Geolocator.checkPermission(); if (permission == LocationPermission.denied) { permission = await Geolocator.requestPermission(); } if (permission == LocationPermission.denied) { throw Exception('Konum izni verilmedi.'); } if (permission == LocationPermission.deniedForever) { throw Exception( 'Konum izni kalıcı olarak reddedildi. Lütfen cihaz ayarlarından izin verin.', ); } return Geolocator.getCurrentPosition(); } }