fluttercommunity / flutter_google_places

Google Places - Google places autocomplete widgets for flutter. No wrapper, use https://pub.dev/packages/google_maps_webservice. Maintainer: @juliansteenbakker
https://pub.dev/packages/flutter_google_places
Other
303 stars 413 forks source link

Because flutter_google_places >=0.3.0 depends on rxdart ^0.26.0 and my proyect depends on rxdart ^0.27.7 #223

Open fefeswa opened 1 year ago

fefeswa commented 1 year ago

same ideas please thank you

fefeswa commented 1 year ago

flutter_google_places_hoc081098 1.2.0

this is function perfect with my issue and is the same code

fefeswa commented 1 year ago

the solution is use this

https://pub.dev/packages/flutter_google_places_hoc081098

is the same code and implementation

Camille-D commented 6 months ago

Hi, I have the same problem. There are pending pull requests to correct the issue. When will this pull request be accepted? the latest version of the package seems a long way away, is this repository still maintained? @juliansteenbakker

fefeswa commented 6 months ago

In flutter_google_places.dart main class it add listener in initState() Timer? _debounce;

@OverRide void initState() { super.initState(); _queryTextController!.addListener(_onQueryChange); // added listener }

in the listener it initialized the _debounce.

void _onQueryChange() { if (_debounce?.isActive ?? false) _debounce!.cancel(); _debounce = Timer(Duration(milliseconds: widget.debounce), () { if (!_queryBehavior.isClosed) { _queryBehavior.add(_queryTextController!.text); } }); } in dispose method it cancels the _debounce with ! operator . @OverRide void dispose() { super.dispose();

_debounce!.cancel();

}

So when we back button pressed without entering text add listener not called and _debounce is not initialized and on dispose we cancel the debounce with ! operator which throws the error because it is not initialized.

So change the _debounce!.cancel() to _debounce?.cancel() will solve the error.

I'm having the same issue, and manually changing _debounce!.cancel() to _debounce?.cancel() worked for me too. Would be great to have this included in a release.

fefeswa commented 6 months ago

Hi, I have the same problem. There are pending pull requests to correct the issue. When will this pull request be accepted? the latest version of the package seems a long way away, is this repository still maintained? @juliansteenbakker

sorry but have time I publish something more check if is valid for you.