title: how to solve white screen error, when navigator.pop shows white screen for QR scan in flutter. How to do Multiple Scan in flutter?
body: <p>How to do Multiple Scan in flutter</p>
  <pre><code>var passthroughData;
  PassthroughQrScanData? passthroughQrScan;
  MobileScannerController cameraController = MobileScannerController();
  bool _screenOpened = false;
  
  class PassthroughQrScanPage extends StatefulWidget {
    final String? schedule_id;
    final String? compoundCode;
    final String? lotNo;
  
    PassthroughQrScanPage({
      this.schedule_id,
      this.compoundCode,
      this.lotNo,
    });
  
    @override
    State&lt;StatefulWidget&gt; createState() =&gt; PageState();
  }
  
  class PageState extends State&lt;PassthroughQrScanPage&gt; {
    final ApiRepository repository = ApiRepository(
      apiClient: ApiClient(
        httpClient: http.Client(),
      ),
    );
  
    @override
    void initState() {}
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Container(
          child: BlocProvider(
            create: (context) =&gt; PassthroughqrscanBloc(repository),
            child: BlocBuilder&lt;PassthroughqrscanBloc, PassthroughqrscanState&gt;(
              builder: (context, state) {
                if (state is PassthroughqrscanEmpty) {
                  return scan(context);
                }
                if (state is PassthroughqrscanError) {
                  return ShowErrorMessage(
                      context, state.error.message.toString());
                }
                if (state is PassthroughqrscanLoaded) {
                  String json = jsonEncode(state.entity);
                  print(&quot;------&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;D&gt;S&gt;D&gt;&gt;$json&quot;);
                  Prefs().setPassthroughData(json);
                  // Navigator.pop(context);
                  WidgetsBinding.instance.addPostFrameCallback((_) {
                    showDialog(
                        context: context,
                        builder: (ctxDialog) =&gt; PassDialog(
                            compoundCode: widget.compoundCode.toString(),
                            lotNo: widget.lotNo.toString(),
                            schedule_id: widget.schedule_id.toString(),
                            screenClosed: _screenWasClosed));
                  });
                
                }
                return Container();
                Center(
                  child: CircularProgressIndicator(),
                );
              },
            ),
          ),
        ),
      );
    }
  
    Widget ShowErrorMessage(BuildContext context, String error) {
      print(&quot;------------------------------/./././$error&quot;);
      WidgetsBinding.instance.addPostFrameCallback((_) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text(error)));
      });
  
      return scan(context);
    }
  
    void _screenWasClosed() {
      _screenOpened = false;
    }
  
    scan(BuildContext mcontext) =&gt; MobileScanner(onDetect: (barcode, args) {
          String code = barcode.rawValue ?? &quot;&quot;;
          debugPrint('Barcode found! $code');
  
          if (code.isNotEmpty) {
            if (!_screenOpened) {
              _screenOpened = true;
              passthroughData = jsonDecode(code);
              passthroughQrScan = PassthroughQrScanData.fromJson(passthroughData);
              BlocProvider.of&lt;PassthroughqrscanBloc&gt;(mcontext, listen: false)
                ..add(VerifyPassthroughBatch(
                    passthroughQrScan?.operationName ?? &quot;&quot;,
                    widget.schedule_id.toString(),
                    passthroughQrScan?.transactionId ?? &quot;&quot;,
                    passthroughQrScan?.transactionRange ?? &quot;&quot;));
            }
          }
        });
  
    // void _foundBarcode(Barcode barcode, MobileScannerArguments? args) {
    //   /// open screen
    //
    //
    // }
  }
  
  class PassDialog extends StatefulWidget {
    // const PassDialog({Key? key}) : super(key: key);
    String? schedule_id;
    String? compoundCode;
    String? lotNo;
    final Function() screenClosed;
  
    PassDialog(
        {required this.schedule_id,
        required this.compoundCode,
        required this.lotNo,
        required this.screenClosed});
  
    @override
    State&lt;PassDialog&gt; createState() =&gt; _PassDialogState();
  }
  
  class _PassDialogState extends State&lt;PassDialog&gt; {
    @override
    void initState() {
      super.initState();
    }
  
    @override
    Widget build(BuildContext context) {
      return SizedBox(
        width: 150,
        height: 100,
        child: AlertDialog(
          content: Row(
            children: [
              ElevatedButton(
                  onPressed: () {
                    widget.screenClosed();
                    Navigator.of(
                      context,
                      rootNavigator: true,
                    ).pop(
                      context,
                    );
                  },
                  child: Text(&quot;Continue&quot;)),
              SizedBox(
                width: 10,
              ),
              ElevatedButton(
                  onPressed: () {
                    WidgetsBinding.instance.addPostFrameCallback((_) {
                      Navigator.push(
                          context,
                          new MaterialPageRoute(
                              builder: (_) =&gt; GluePassthroughUploadPage(
                                    id: widget.schedule_id.toString(),
                                    compoundCode: widget.compoundCode.toString(),
                                    lotNo: widget.lotNo.toString(),
                                  )));
                    });
                  },
                  child: Text(&quot;Show Add page&quot;)),
            ],
          ),
        ),
      );
    }
  }
  
  Future buildShowDialog(BuildContext context) {
    return showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return Center(
            child: CircularProgressIndicator(),
          );
        });
  }
  </code></pre>
  <p>After QR scan, bloc activates and shows Alert dialog box, when API call is correct. Then, When I give continue in Alert dialog box navigator.pop is added so pop should show a mobile scanner to scan another QR but it shows White screen why? any camera controller should be activated when I give pop. how to solve this white screen error????</p>