Persist data with SQLite

Store key-value data on disk

Read and write files

Cookbook

Persistence

Read and write files

1. Find the correct local path

2. Create a reference to the file location

3. Write data to the file

4. Read data from the file

Complete example

In some cases, you need to read and write files to disk.
For example, you may need to persist data across app launches,
or download data from the internet and save it for later offline use.

To save files to disk, combine the path_provider
plugin with the dart:io library.

This recipe uses the following steps:

Find the correct local path.

Create a reference to the file location.

Write data to the file.

Read data from the file.