Remember You must wait until the controller has finished
  initializing before working with the camera. Therefore,
  you must wait for the _initializeControllerFuture() created
  in the previous step to complete before showing a CameraPreview.

Use a FutureBuilder for exactly this purpose.

5. Take a picture with the CameraController

takePicture() method, which returns an

XFile,
a cross-platform, simplified

In this example, create a FloatingActionButton that takes a picture
using the CameraController when a user taps on the button.

Taking a picture requires 2 steps:

Ensure that the camera is initialized.

Use the controller to take a picture and ensure that it returns a Future<XFile>.

It is good practice to wrap these operations in a try / catch block in order
to handle any errors that might occur.

6. Display the picture with an Image widget