Baseflow / flutter-geocoding

A Geocoding plugin for Flutter
https://baseflow.com
MIT License
139 stars 71 forks source link

[Question]: Getting error "Null check operator used on null value" while using Geocoding package. #253

Closed hasnainahmed-4289 closed 1 week ago

hasnainahmed-4289 commented 1 week ago

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

hasnainahmed-4289 commented 1 week ago

Problem was that I was running it on desktop. It works on mobile. Regards.