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

Widget _searchInput returns a future inside setstate #2

Closed
EsbenSoeltoft opened this issue Apr 1, 2020 · 2 comments
Closed

Widget _searchInput returns a future inside setstate #2

EsbenSoeltoft opened this issue Apr 1, 2020 · 2 comments

Comments

@EsbenSoeltoft
Copy link

in file map_box_place_search_widget.dart line 170 it calls setState(() => _autocompletePlace(value));

_autocompletePlace is a async function so it complains during runtime that a Future is returned during setState.

@pMertDogan
Copy link

pMertDogan commented Apr 23, 2020

Same

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: setState() callback argument returned a Future. E/flutter (23377): The setState() method on _MapBoxPlaceSearchWidgetState#93213(ticker inactive) was called with a closure or method that returned a Future. Maybe it is marked as "async". E/flutter (23377): Instead of performing asynchronous work inside a call to setState(), first execute the work (without updating the widget state), and then synchronously update the state inside a call to setState(). E/flutter (23377): #0 State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1151:9) E/flutter (23377): #1 State.setState (package:flutter/src/widgets/framework.dart:1167:6) E/flutter (23377): #2 _MapBoxPlaceSearchWidgetState._searchInput.<anonymous closure>.<anonymous closure> (package:mapbox_search_flutter/src/map_box_place_search_widget.dart:170:21) E/flutter (23377): #3 _rootRun (dart:async/zone.dart:1122:38) E/flutter (23377): #4 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter (23377): #5 _CustomZone.runGuarded (dart:async/zone.dart:925:7) E/flutter (23377): #6 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23) E/flutter (23377): #7 _rootRun (dart:async/zone.dart:1126:13) E/flutter (23377): #8 _CustomZone.run (dart:async/zone.dart:1023:19) E/flutter (23377): #9 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23) E/flutter (23377): #10 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15) E/flutter (23377): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19) E/flutter (23377): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5) E/flutter (23377): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12) E/flutter (23377):

@ketanchoyal
Copy link
Owner

I'll look into it asap!

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

No branches or pull requests

3 participants