0

I'm trying to use Geocoder Dependence but it does not don't support null safety. Is there any method to use Geocoder Dependence in the project?

Here is the error

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:geocoder

For solutions, see https://dart.dev/go/unsound-null-safety


FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 27s
Exception: Gradle task assembleDebug failed with exit code 1
SuperStormer
  • 4,997
  • 5
  • 25
  • 35
Adeel Nazim
  • 640
  • 6
  • 17
  • Instead of `geocoder`, could you check if `flutter_geocoder` does what you want (which does support null-safety)? Alternative, it seems like there are some recent activity on `geocoder` where `master` branch is now null-safe but has yet to be released: https://github.com/aloisdeniel/flutter_geocoder/issues/68 . There are some description in the link about how to use the `master` version for now. – julemand101 Aug 18 '21 at 08:34
  • Ok, I have added an answer you can accept. – julemand101 Aug 18 '21 at 08:50
  • Already do it Brother. – Adeel Nazim Aug 18 '21 at 09:40
  • Not sure what you are talking about? Try refresh your page since my answer should be there. – julemand101 Aug 18 '21 at 09:59

1 Answers1

0

There seems to be some recent activity on the geocoder package where the version on the master branch is now null-safety compatible but the version has yet to be released on pub.dev. You can check this issue here there are also some suggestion about how to use the master version directly instead of fetching the package from pub.dev:

https://github.com/aloisdeniel/flutter_geocoder/issues/68

Alternative, you can take a look at the flutter_geocoder package which seems to be a fork of geocoder and does support null-safety according to pub.dev.

And I know, it is confusing that the geocoder package does calls its GitHub repository for flutter_geocoder. But flutter_geocoder and geocoder is two different packages on pub.dev with different GitHub projects behind it which both has the same name but is created by different users. :)

julemand101
  • 28,470
  • 5
  • 52
  • 48