getCurrentLocation method
Implementation
Future getCurrentLocation() async {
final hasPermission =
(await _location.hasPermission()) == location.PermissionStatus.granted;
if (!hasPermission) {
await _location.requestPermission();
}
final fetchedLocation = await _location.getLocation();
final model = LocationModel(
latitude: fetchedLocation.latitude ?? 0,
longitude: fetchedLocation.longitude ?? 0,
);
final address = await getAddress(model);
currentLocation = currentLocation.copyWith(
latitude: fetchedLocation.latitude,
longitude: fetchedLocation.longitude,
address: address,
);
_currentLocation = currentLocation;
moveToCurrentLoction();
notifyListeners();
}