Open fefeswa opened 1 year ago
flutter_google_places_hoc081098 1.2.0
this is function perfect with my issue and is the same code
the solution is use this
https://pub.dev/packages/flutter_google_places_hoc081098
is the same code and implementation
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
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.
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.
same ideas please thank you