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

Flutter Google Place Search not working after upgrading to Flutter Version 2 #162

Closed
basheerbsr79 opened this issue Apr 8, 2021 · 5 comments
Assignees
Labels
To Release This issue will be available in the next release

Comments

@basheerbsr79
Copy link

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Null check operator used on a null value
E/flutter ( 900): #0 PlacesAutocompleteState.doSearch (package:flutter_google_places/src/flutter_google_places.dart:436)
E/flutter ( 900): #1 _rootRunUnary (dart:async/zone.dart:1362)
E/flutter ( 900): #2 _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter ( 900): #3 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170)
E/flutter ( 900): #4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
E/flutter ( 900): #5 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271)
E/flutter ( 900): #6 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:378)
E/flutter ( 900): #7 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:244)
E/flutter ( 900): #8 _StartWithStreamSink.add (package:rxdart/src/transformers/start_with.dart:15)
E/flutter ( 900): #9 forwardStream... (package:rxdart/src/utils/forwarding_stream.dart:31)
E/flutter ( 900): #10 forwardStream.runCatching (package:rxdart/src/utils/forwarding_stream.dart:21)
E/flutter ( 900): #11 forwardStream.. (package:rxdart/src/utils/forwarding_stream.dart:31)
E/flutter ( 900): #12 _rootRunUnary (dart:async/zone.dart:1362)
E/flutter ( 900): #13 _CustomZone.runUnary (dart:async/zone.dart:1265)
E/flutter ( 900): #14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170)
E/flutter ( 900): #15 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341)
E/flutter ( 900): #16 _DelayedData.perform (dart:async/stream_impl.dart:591)
E/flutter ( 900): #17 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706)
E/flutter ( 900): #18 _PendingEvents.schedule. (dart:async/stream_impl.dart:663)
E/flutter ( 900): #19 _rootRun (dart:async/zone.dart:1346)
E/flutter ( 900): #20 _CustomZone.run (dart:async/zone.dart:1258)
E/flutter ( 900): #21 _CustomZone.runGuarded (dart:async/zone.dart:1162)
E/flutter ( 900): #22 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202)
E/flutter ( 900): #23 _rootRun (dart:async/zone.dart:1354)
E/flutter ( 900): #24 _CustomZone.run (dart:async/zone.dart:1258)
E/flutter ( 900): #25 _CustomZone.runGuarded (dart:async/zone.dart:1162)
E/flutter ( 900): #26 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202)
E/flutter ( 900): #27 _microtaskLoop (dart:async/schedule_microtask.dart:40)
E/flutter ( 900): #28 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49)

@adam-weissert
Copy link

This same issue was occurring for me as well after upgrading the package to v0.3.0, its dependencies, and Flutter to the current stable channel.

Judging by the first error, it looks like the null safety on types, components, and strictbounds is causing this.

Here's a fix I included in my PlacesAutocomplete.show() function:

Prediction p = await PlacesAutocomplete.show(
          context: context,
          apiKey: kGoogleApiKey,
          mode: Mode.overlay,
          types: [],
          language: "en",
          components: [Component(Component.country, "us")],
          strictbounds: false,
        );

Take a look at the Google Maps docs for this function as well

@KevMorelli
Copy link
Collaborator

@adam-weissert thank you for your hotfix, I already fix this and some other properties having similar issues, I will release another version this weekend so I have a little more time to fix other issues

@KevMorelli KevMorelli self-assigned this Apr 9, 2021
@KevMorelli KevMorelli added the To Release This issue will be available in the next release label Apr 9, 2021
@Adrek
Copy link

Adrek commented May 24, 2021

The new version will depend on rxdart ^ 0.27.0?

I updated to the latest versions of the FlutterFire and GeoFlutterFire packages so they don't conflict. But I get this error:

Running "flutter pub get" in ubercloneflutter...                
Because no versions of geoflutterfire match >3.0.0-nullsafety.4 <4.0.0 and geoflutterfire 3.0.0-nullsafety.4 depends on rxdart ^0.27.0, geoflutterfire ^3.0.0-nullsafety.4 requires rxdart ^0.27.0.

And because flutter_google_places >=0.3.0 depends on rxdart ^0.26.0, geoflutterfire ^3.0.0-nullsafety.4 is incompatible with flutter_google_places >=0.3.0.

So, because ubercloneflutter depends on both flutter_google_places ^0.3.0 and geoflutterfire ^3.0.0-nullsafety.4, version solving failed.
pub get failed (1; So, because ubercloneflutter depends on both flutter_google_places ^0.3.0 and geoflutterfire ^3.0.0-nullsafety.4, version solving failed.)
exit code 1

@scortumee
Copy link

scortumee commented Jun 2, 2021

@Adrek you can do a temporary workaround for the problem you are having like below

dependencies: 
  ...
  rxdart: ^0.27.0
dependency_overrides:
  rxdart: ^0.26.0

in your pubspec.yaml file

@juliansteenbakker
Copy link
Collaborator

This issue will be tracked in #164, expect an update soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
To Release This issue will be available in the next release
Projects
None yet
Development

No branches or pull requests

6 participants