location_geocoder 错误状态:没有元素

location_geocoder Bad state: No element

如果我想使用地理编码器,它会给我这个错误信息:Bad state: No element.

我现在已经为地理编码器提供了一个正确书写的城市名称,并且我已经为地理编码器提供了一个来自付费 google 地图平台帐户的 api 密钥。

颤动运行:

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

我现在不支持 location_geocoder 的任何东西,但如果我评论地理编码器部分:我不再有错误了。

扑博士:

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.

请帮帮我

只需使用对我有用的 http 包 location_geocoder