diff --git a/example/README.md b/example/README.md index 84b8a41..43e4013 100644 --- a/example/README.md +++ b/example/README.md @@ -56,7 +56,9 @@ class _MyHomePageState extends State { // values only when widget is visible child: VisibilityDetector( onVisibilityChanged: (VisibilityInfo info) { - visible = info.visibleFraction > 0; + if (context.mounted) { + visible = info.visibleFraction > 0; + } }, key: Key('visible-detector-key'), child: BarcodeKeyboardListener(