Search code examples
flutterdartlocation

location_geocoder Bad state: No element


if i want to make use from geocoder it given me this error message: Bad state: No element.

what i now is that i have giving geocoder a correctly written city name and also that i have given geocoder a api key from a payed google maps platform account.

flutter run:

Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...                                             14.3s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        13.8s
Xcode build done.                                           633.2s
Syncing files to device iPhone 13...                               186ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:50040/6fcE371o6S0=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:50040/6fcE371o6S0=/
flutter: null
flutter: stadt_view: bansko
flutter: Bad state: No element
flutter: null

i now that ther don't stand anything from location_geocoder but if i comment the geocoder part out: i don't have the bug anymore.

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 12.1 21C52 darwin-x64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Community Edition (version 2020.3.3)
[✓] VS Code (version 1.64.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

Please help me


Solution

  • just use http package instead location_geocoder that worked for me