MobIT
MobIT

Reputation: 980

flutter google places: Unhandled Exception: Null check operator used on a null value

I am developing an application using google map and google places.

When I call PlacesAutocomplete.show(), it gives the following error message. Null check operator used on a null value

screenshot

Thanks in advance.

Upvotes: 0

Views: 2953

Answers (1)

ama
ama

Reputation: 180

You need to provide all the required and non null parameters of the function .show. Something like that:

Prediction p = await PlacesAutocomplete.show(
      offset: 0,
      radius: 1000,
      strictbounds: false,
      region: "us",
      language: "en",
      context: context,
      mode: Mode.overlay,
      apiKey: Env.googleapikey,
      sessionToken: sessionToken,
      components: [new Component(Component.country, "us")],
      types: ["(cities)"],
      hint: "Search City",
      startText: city == null || city == "" ? "" : city
    );

Upvotes: 4

Related Questions