Saving and retrieving pictures as local files

Still in the _CameraScreenState class, in the AppBar in the build() method, we'll set the actions parameter so that it contains an IconButton. When pressed, this will store the picture in the temp directory, which can be found using the path_provider plugin. The name of the file will just be the current date and time.

Next, we can finally call the takePicture() method of the CameraController. This will save the picture into the provided path, as shown in the following code block:

actions: <Widget>[    IconButton(        icon: Icon(Icons.camera_alt),        onPressed: () async {            final path = join(                (await getTemporaryDirectory()).path,                '${DateTime.now()}.png',            ); // Attempt to take a picture and log where it's been ...

Get Flutter Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.