As a workaround wrap your code that calling setState
into WidgetsBinding.addPostFrameCallback:
WidgetsBinding.instance
.addPostFrameCallback((_) => setState(() {}));
That way you can be sure it gets executed after the current widget is built.
More Related Contents:
- The argument type ‘String’ can’t be assigned to the parameter type ‘Uri’
- Passing data between screens in Flutter
- After updating cloud firestore: The operator ‘[]’ isn’t defined for the type ‘Object’. Try defining the operator ‘[]’
- Adding a splash screen to Flutter apps
- Flutter – Wrap text on overflow, like insert ellipsis or fade
- How to refresh an AlertDialog in Flutter?
- Converting timestamp
- How to change package name in flutter?
- How to add a ListView to a Column in Flutter?
- Flutter Error: MediaQuery.of() called with a context that does not contain a MediaQuery
- InkWell not showing ripple effect
- How to debounce Textfield onChange in Dart?
- How can I dismiss the on screen keyboard?
- How do I split or chunk a list into equal parts, with Dart?
- How do I stretch an image to fit the whole background (100% height x 100% width) in Flutter?
- How to decode JSON in Flutter?
- How do I use Dart extension functions?
- Overflowing text does not wrap
- How to check if scroll position is at top or bottom in ListView?
- Visual Studio not installed; this is necessary for Windows development
- AlertDialog without context in Flutter
- flutter run function every x amount of seconds
- Google map in Flutter not responding to touch events
- Flutter/Dart: Convert HEX color string to Color?
- How to handle app lifecycle with Flutter (on Android and iOS)?
- How to create toolbar searchview in flutter
- Flutter Navigation pop to index 1
- How to customize a date picker
- How to set Custom height for Widget in GridView in Flutter?
- Flutter floating action button with speed dial