While using Geocoding I always get error message "null check operator used on null value". I wrapped it with try catch and I think issue is in the package.
I need location name from coordinates to display.
What could be the issue?
I am currently running app on desktop.
position.latitude & position.longitude is not empty.
This is the part where I used package :
Future<CurrentWeatherModel> getCurrentWeather() async { try { Position position = await _determinePosition(); try { //Package not working.. List<Placemark> placemarks = await placemarkFromCoordinates(position.latitude, position.longitude); } catch (e) { print("Error in placemarkFromCoordinates: $e"); } dynamic weatherData = await _apiServices.getWeather( url: AppUrl.getCurrentWeatherApiEndpoint( latitude: position.latitude.toString(), longitude: position.longitude.toString())); CurrentWeatherModel weatherDataClass = CurrentWeatherModel.fromJson(weatherData); return weatherDataClass; } catch (e) { print(e.toString()); throw e; } }
Error message is :
flutter: Error in placemarkFromCoordinates: Null check operator used on a null value
Please check the following before submitting a new issue.
Please select for which platform(s) you need help
Your question
While using Geocoding I always get error message "null check operator used on null value". I wrapped it with try catch and I think issue is in the package. I need location name from coordinates to display. What could be the issue? I am currently running app on desktop.
This is the part where I used package :
Future<CurrentWeatherModel> getCurrentWeather() async { try { Position position = await _determinePosition(); try { //Package not working.. List<Placemark> placemarks = await placemarkFromCoordinates(position.latitude, position.longitude); } catch (e) { print("Error in placemarkFromCoordinates: $e"); } dynamic weatherData = await _apiServices.getWeather( url: AppUrl.getCurrentWeatherApiEndpoint( latitude: position.latitude.toString(), longitude: position.longitude.toString())); CurrentWeatherModel weatherDataClass = CurrentWeatherModel.fromJson(weatherData); return weatherDataClass; } catch (e) { print(e.toString()); throw e; } }
Error message is :flutter: Error in placemarkFromCoordinates: Null check operator used on a null value
Version
geocoding: ^3.0.0