[英]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.