Committed by
David PHAM-VAN
check if widget is mounted before setState
Showing
1 changed file
with
3 additions
and
0 deletions
@@ -158,6 +158,9 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom> | @@ -158,6 +158,9 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom> | ||
158 | if (!infoLoaded) { | 158 | if (!infoLoaded) { |
159 | infoLoaded = true; | 159 | infoLoaded = true; |
160 | Printing.info().then((PrintingInfo printingInfo) { | 160 | Printing.info().then((PrintingInfo printingInfo) { |
161 | + if (!mounted) { | ||
162 | + return; | ||
163 | + } | ||
161 | setState(() { | 164 | setState(() { |
162 | info = printingInfo; | 165 | info = printingInfo; |
163 | raster(); | 166 | raster(); |
-
Please register or login to post a comment