Skip to content

Commit 4622e29

Browse files
authored
LiveList: fix setState after dispose (#475)
1 parent ceb17f6 commit 4622e29

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/flutter/lib/src/utils/parse_live_list.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ class _ParseLiveListWidgetState<T extends sdk.ParseObject>
134134
: buildAnimatedList();
135135
}
136136

137+
@override
138+
void setState(VoidCallback fn) {
139+
if (mounted) {
140+
super.setState(fn);
141+
}
142+
}
143+
137144
Widget buildAnimatedList() {
138145
return AnimatedList(
139146
key: _animatedListKey,
@@ -235,6 +242,13 @@ class _ParseLiveListElementWidgetState<T extends sdk.ParseObject>
235242

236243
StreamSubscription<T> _streamSubscription;
237244

245+
@override
246+
void setState(VoidCallback fn) {
247+
if (mounted) {
248+
super.setState(fn);
249+
}
250+
}
251+
238252
@override
239253
void dispose() {
240254
_streamSubscription?.cancel();

0 commit comments

Comments
 (0)