Session
BuildContext Across Async Gaps: The Bug Every Flutter Team Ships At Least Once
Every Flutter team ships this bug at least once: you await something inside a widget, the widget gets disposed while you're waiting, and then you use BuildContext on the other side of that gap. Best case, you get a red screen in debug mode. Worst case, it slips past testing and shows up as a crash in production weeks later.
This talk breaks down why this happens at a fundamental level, the variants that catch even experienced developers off guard (nested async calls, Future.wait, callbacks inside then()), and why Dart's own lint rules only catch the obvious cases. We'll walk through real patterns to prevent it for good: proper mounted checks, understanding exactly when a State object is disposed relative to your async call, and how state management solutions like Riverpod and Bloc sidestep the problem structurally rather than just papering over it with a check.
By the end, you won't just know how to fix this bug, you'll understand why it exists in the first place, which is the difference between patching symptoms and actually preventing it across your codebase.
Abhishek Doshi
Google Developer Expert for Dart, Flutter, and Firebase, and Developer Relations Engineer at Shorebird
Surat, India
Links
Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.
Jump to top