I am creating a barcode scanner functionality for a Flutter app. Most of the work has been done by the awesome guys at FlutterFire, and I'm using the example they have on their github, found here [here](https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_ml_vision/example/lib/camera_preview_scanner.dart).

My question: what would be the best way to navigate away from this screen when a barcode is found, and return when a users presses back, without leaving the camera scanning or active in the background?

**Edit**

The problem lies in pausing both the `_camera.startImageStream`, and the `ScannerUtils.detect(` function.

I have tried calling the `_initializeCamera` function after awaiting the Navigator.push, but it seems that the initialize function is not done before the view is ready.