简体   繁体   English

Flutter_google_places null 校验算子

[英]Flutter_google_places null check operator

In my Flutter application, I'm trying to implement flutter_google_places在我的 Flutter 应用程序中,我正在尝试实现 flutter_google_places

When calling PlacesAutocomplete.show调用PlacesAutocomplete.show

I get this error:我收到此错误:

Null check operator used on a null value" #0 Null 检查运算符用于 null 值"#0
PlacesAutocompleteState.doSearch (package:flutter_google_places/src/flutter_google_places.dart:436:28) PlacesAutocompleteState.doSearch(包:flutter_google_places/src/flutter_google_places.dart:436:28)

I call it this: kGoogleApiKey is provided as a string.我称之为: kGoogleApiKey作为字符串提供。

PlacesAutocomplete.show(
  context: context,
  apiKey: kGoogleApiKey,
  mode: Mode.fullscreen, // Mode.overlay
  language: "en",
  components: [Component(Component.country, "pk")]
).then((value) => print(value))

Using:使用:

flutter_google_places: ^0.3.0
google_maps_webservice: ^0.0.16

In Flutter 3.3.1在 Flutter 3.3.1

According to this github issue , you will need to provide more arguments to your function call.根据此 github 问题,您需要向您的 function 调用提供更多 arguments。 If they are not provided, the function body will still try to access these non-existing values and throw an exception while doing so.如果未提供它们,function 主体仍将尝试访问这些不存在的值并在这样做时抛出异常。

Prediction p = await PlacesAutocomplete.show(
  offset: 0,
  radius: 1000,
  types: [],
  strictbounds: false,
  region: "ar",
  context: context,
  apiKey: kGoogleApiKey,
  mode: Mode.overlay, // Mode.fullscreen
  language: "en",
  components: [Component(Component.country, "pk")]
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 flutter_google_places 未显示自动完成搜索结果 - flutter_google_places not showing autocomplete search results 使用 flutter_google_places 自动完成搜索不起作用? - Autocomplete search with flutter_google_places doesn't work? 显然 flutter_google_places 需要代理服务器? - Apparently flutter_google_places requires a proxy server? flutter google 地方:未处理的异常:Null 检查运算符用于 null 值 - flutter google places: Unhandled Exception: Null check operator used on a null value flutter_google_places:pubspec.yaml 文件中的 ^0.2.1 插件错误 - flutter_google_places: ^0.2.1 plugin error in pubspec.yaml file pub 失败:因为 flutter_google_places >=0.2.5 取决于 rxdart ^0.24.0 上 rxdart ^0.23.1, - pub get failed: Because flutter_google_places >=0.2.5 depends on rxdart ^0.24.0 on rxdart ^0.23.1, 使用 GooglePlacesAutocompleteWidget 时强制 flutter_google_places 仅显示城市 - Force flutter_google_places to only display cities when using GooglePlacesAutocompleteWidget getApplicationDocumentsDirectory 对 Flutter 中的 null 运算符进行 null 检查 - getApplicationDocumentsDirectory throws null check on null operator in Flutter 颤振:在空值上使用空检查运算符? - flutter: Null check operator used on a null value? Flutter Null 检查运算符用于 null 值 - Flutter Null check operator used on a null value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM