Skip to content

Commit 594a2b1

Browse files
Merge pull request #31 from SpencerLindemuth/master
Don't call setDimensions when widget has been disposed and BuildContext is null
2 parents 6a39cba + c7f1f84 commit 594a2b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/responsive_wrapper.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,10 @@ class _ResponsiveWrapperState extends State<ResponsiveWrapper>
461461
// The required MediaQueryData is only available
462462
// on the next frame for physical dimension changes.
463463
WidgetsBinding.instance.addPostFrameCallback((_) {
464-
setDimensions();
465-
setState(() {});
464+
if(context != null) {
465+
setDimensions();
466+
setState(() {});
467+
}
466468
});
467469
}
468470

0 commit comments

Comments
 (0)