Commit 5adc718
committed
void dispose() {
// The ad object (_loadedAd) is intentionally not disposed of here.
// Its lifecycle is managed by the InlineAdCacheService. The cache for this
// feed's context (e.g., 'all', 'followed', or a filter ID) is cleared
// by the HeadlinesFeedBloc during a pull-to-refresh, which is the
// correct and only time these feed ads should be disposed. This prevents
// ads from being destroyed when they scroll out of view.
// Cancel any pending ad loading operation when the widget is disposed.
// This prevents `setState()` calls on a disposed widget.
if (_loadAdCompleter != null && !_loadAdCompleter!.isCompleted) {
1 parent b867d53 commit 5adc718
1 file changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
0 commit comments