Просмотр исходного кода

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

vishnukvmd 2 лет назад
Родитель
Сommit
56339cea5d
1 измененных файлов с 1 добавлено и 1 удалено
  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);
     }