Saving Data in Flutter

Data is king! In this course you’ll see different techniques to store data in your Flutter apps. You will use SharedPreferences to store key-value pairs, convert objects in JSON format (and viceversa), read and write data to text files, and convert images into streams of data. At the end of this course, you’ll be able to choose how to save data in your apps, and use some of the most common Flutter storing options. By Simone Alessandria.

Leave a rating/review
Download materials
Save for later
Comments
Share

Who is this for?

Developers who want to store data locally with Flutter

Covered concepts

  • Storage options
  • SharedPreferences
  • JSON
  • flutter_secure_storage
  • path_provider
  • Local files: read and write
  • Storing data as bytes

Part 1: Store Data with Flutter

01
Toggle description

Learn about some of the most common storing options in Flutter: SharedPreferences, Flutter secure Storage, local files, SQL and NoSQL Databases and cloud tools like Firebase.

Toggle description

While most apps need to store data in one way or another, each project has different needs. You should take into account several factors, like data size, security, performance, persistence, target platforms and complexity. Learn how to choose the right solution based on real world scenarios.

In this quick challenge episode, you’ll see three different real world scenarios for potential apps. For each scenario, try to pick the best storage option!

Part 2: Use SharedPreferences & Secure Storage

Toggle description

Learn how to leverage SharedPreferences in Flutter, and the target platforms you can address. See the data types you can store, and the methods to read, add, edit, and update your data.

In this episode, you will create a helper class that contains the methods to insert, read, update and delete data to your SharedPreferences instance.

In this episode, you’ll see how to connect your UI to the helper class that interacts with SharedPreferences, and how to dynamically view and change data from your app.

In this episode, you’ll see how to connect your UI to the helper class that interacts with SharedPreferences, and how to dynamically view and change data from your app.

Toggle description

In this challenge, you will add another field to the settings: the option to show the date: once this is done you will update your helper class to read and write the new field to SharedPreferences.

Toggle description

In this episode, you’ll transform your app so that your settings will be stored securely, using the flutter_secure_storage package.

Part 3: Reading & Writing Files

Toggle description

In this episode, you will learn where you can store your files, and how to leverage path and path_provider to set and retrieve paths that deal with files.

Toggle description

In this episode, you will see how to write content for a recipe in a new file, and then retrieve its content.

Toggle description

In this episode, you will create the screen that shows all the files in the documents directory of your app, leveraging a ListView widget and the path_provider package.

Toggle description

In this episode, you will create the screen that shows all the files in the documents directory of your app, leveraging a ListView widget and the path_provider package.

Toggle description

In this episode, you will create the screen that shows the details of a single text file and allows reading and writing its content.

Toggle description

Add the function to delete a file, from the file list screen and the file screen, and implement a correct navigation for the app.

Toggle description

One of the most common approaches when storing data is using the JSON format. Learn how to transform your custom objects into JSON, and then from JSON content create instances of your classes.

Toggle description

One of the most common approaches when storing data is using the JSON format. Learn how to transform your custom objects into JSON, and then from JSON content create instances of your classes.

Challenge yourself by exploring the FileStat object, then add an info button in the file screen that calls stat or statSync, and shows the information about the file in a dialog window.

Summary 2:39
Toggle description

Recap the main content of the course in this summary.