Browse Source

[Unrelated] Ensure that the widget is mounted before using BuildContext

vishnukvmd 2 years ago
parent
commit
56339cea5d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/ui/viewer/file/zoomable_live_image.dart

+ 1 - 1
lib/ui/viewer/file/zoomable_live_image.dart

@@ -166,7 +166,7 @@ class _ZoomableLiveImageState extends State<ZoomableLiveImage>
   void _showLivePhotoToast() async {
     var preferences = await SharedPreferences.getInstance();
     int promptTillNow = preferences.getInt(kLivePhotoToastCounterKey) ?? 0;
-    if (promptTillNow < kMaxLivePhotoToastCount) {
+    if (promptTillNow < kMaxLivePhotoToastCount && mounted) {
       showToast(context, "Press and hold to play video");
       preferences.setInt(kLivePhotoToastCounterKey, promptTillNow + 1);
     }