Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working #164

Open
bksuser opened this issue Apr 20, 2021 · 17 comments
Open

Not working #164

bksuser opened this issue Apr 20, 2021 · 17 comments

Comments

@bksuser
Copy link

bksuser commented Apr 20, 2021

[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: Null check operator used on a null value
#0 PlacesAutocompleteState.doSearch (package:flutter_google_places/src/flutter_google_places.dart:436:28)
#1 _rootRunUnary (dart:async/zone.dart:1362:47)
#2 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#3 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#5 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#6 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:378:25)
#7 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:244:5)
#8 _StartWithStreamSink.add (package:rxdart/src/transformers/start_with.dart:15:10)
#9 forwardStream... (package:rxdart/src/utils/forwarding_stream.dart:31:49)

@saurabhunify
Copy link

Same issue

@in3mo
Copy link

in3mo commented Apr 22, 2021

You have to send all the parameters of the 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: "es",
components: [Component(Component.country, "ar")]
);

@hoc081098
Copy link

hoc081098 commented May 9, 2021

Trying it: https://pub.dev/packages/flutter_google_places_hoc081098

  • Migrated to null-safety.
  • Updated dependencies to latest release.
  • Refactoring by using RxDart for more power.
  • Fixed many issues.
  • Applied flutter_lints.
  • Refactored example, migrated to Android v2 embedding.

@hdavidmb
Copy link

hdavidmb commented May 9, 2021

Same problem. Is anybody even working on this?

@hdavidmb
Copy link

hdavidmb commented May 9, 2021

Complementing @in3mo answer. The conflicting parameters are types, strictbounds and components .

This parameters are marked as optional in the show() method but later they are being checked as non-null (the "!" checker) in flutter_google_places-0.3.0/lib/src/flutter_google_places.dart on the doSearch() method (line 429):

final res = await _places!.autocomplete(
        value,
        offset: widget.offset,
        location: widget.location,
        radius: widget.radius,
        language: widget.language,
        sessionToken: widget.sessionToken,
        types: widget.types!,  //!<---------------------- Here
        components: widget.components!, //!<------------- Here
        strictbounds: widget.strictbounds!, //!<---------- Here
        region: widget.region,
      );

The problem is that specifying components will limit the search results to the countries you pass on those components parameter. So you should pass an empty list on components parameter in order to let the results to be from any country.

@hdavidmb
Copy link

hdavidmb commented May 9, 2021

@hoc081098 I'm trying your package and it's working great on version ^1.0.0-nullsafety.1

I had to downgrade because the last version (^1.0.0-nullsafety.2) depends on rxdart ^0.27.0 and has a conflict with other package I'm using which last version depends on rxdart ^0.26.0. Is it any way to make flutter_google_places_hoc081098 depend on rxdart <=0.27.0?

And I'm also having another issue (as well as in flutter_google_places). Importing the main package with import 'package:flutter_google_places_hoc081098/flutter_google_places_hoc081098.dart'; doesn't expose the Prediction class and my dart file doesn't recognize it. So I had to import places.dart with import 'package:google_maps_webservice/src/places.dart';

But anyways, thanks for your package. 🙏🏽

@hoc081098
Copy link

@hoc081098 I'm trying your package and it's working great on version ^1.0.0-nullsafety.1

I had to downgrade because the last version (^1.0.0-nullsafety.2) depends on rxdart ^0.27.0 and has a conflict with other package I'm using which last version depends on rxdart ^0.26.0. Is it any way to make flutter_google_places_hoc081098 depend on rxdart <=0.27.0?

And I'm also having another issue (as well as in flutter_google_places). Importing the main package with import 'package:flutter_google_places_hoc081098/flutter_google_places_hoc081098.dart'; doesn't expose the Prediction class and my dart file doesn't recognize it. So I had to import places.dart with import 'package:google_maps_webservice/src/places.dart';

But anyways, thanks for your package. 🙏🏽

If you're using rxdart: 0.26.0, just use 1.0.0-nullsafety.1 :))

@bksuser
Copy link
Author

bksuser commented May 10, 2021

Not working

@vanshkapoor
Copy link

Got this issue when upgraded to null safety.
Solved it by changing type to this
image

@JagadishaIncture
Copy link

For Inidan Users

Prediction? p = await PlacesAutocomplete.show( offset: 0, radius: 1000, types: [], strictbounds: false, region: "in", context: context, apiKey: Constants.API_KEY, mode: Mode.overlay, // Mode.fullscreen language: "en", onError: (value) { Utils.displayToast(context, value.errorMessage!); }, components: [Component(Component.country, "in")] );

@abdulrehmank7
Copy link

Instead of using this plugin, I created a utility class for Google places auto complete : https://arkapp.medium.com/flutter-and-google-map-for-beginners-part-1-fdba4ab22148

@juliansteenbakker
Copy link
Collaborator

I have just became maintainer of this package so I'm planning on getting it back on track and up to date with the latest version of Flutter.

@hoc081098 I see you have lot's of improvements in your fork. Do you think it it's possible to backport new features into this original package?

@sockogamez
Copy link

sockogamez commented Jan 8, 2022

SOLVED!!!

first make this :
flutter channel stable
flutter upgrade
flutter pub cache repair
flutter clean

then :
is working whitout changes .. just put this parameters in the section like this :

Prediction p = await  PlacesAutocomplete.show(
    context: context, // required
    apiKey: Enviroment.API_KEY_MAPS, // required
    mode: Mode.overlay, // required any
    language: 'es', // required any
    region:'mx',  // any 
    strictbounds: true, //required
    radius: 1000, // any
    offset: 0, // required 
    types: [], //required
    startText: '',
    components: [lugares.Component(lugares.Component.country, "mx")], // required any
    location: lugares.Location( lat:_position.latitude,lng: _position.longitude) // required any
);

Good look people.
Sin título

@victormanuelfrancodev
Copy link

Trying it: https://pub.dev/packages/flutter_google_places_hoc081098

  • Migrated to null-safety.
  • Updated dependencies to latest release.
  • Refactoring by using RxDart for more power.
  • Fixed many issues.
  • Applied flutter_lints.
  • Refactored example, migrated to Android v2 embedding.

thx !! !!

@Jigneshiosdeveloper
Copy link

I fixed this error below.

https://youtu.be/ZDVhfIesqBg

@juliansteenbakker
Copy link
Collaborator

Can you please try the following in pubspec.yaml

  flutter_google_places:
    git:
      url: https://github.com/fluttercommunity/flutter_google_places
      ref: v0.3.2

Once i have the permissions, i will upload the changes to pub.dev

@ryanlangton
Copy link

Is this going to be pushed to pub.dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests