asaarnak
Committed by David PHAM-VAN

check if widget is mounted before setState

@@ -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();