Using secure storage to store data
- A very common task for apps is storing user credentials, or other sensitive data, within the app itself.
SharedPreferencesis not an ideal tool to perform this task as data cannot be encrypted. In this recipe, you will learn how to store encrypted data usingflutter_secure_storage, which provides an easy and secure way to store data.
Getting ready
To follow along with this recipe, you will need to do the following:
- If you are using Android, you need to set the
compileSdkVersionin your app'sbuild.gradlefile to33. The file is located in your project folder, in/android/app/build.gradle. ThecompileSdkVersionkey must be set in thedefaultConfignode, like this:
compileSdkVersion 33
- Download the starting code for this app, which is available at https://github.com/PacktPublishing/Flutter-Cookbook/tree/master/chapter_08.
How to do it...
For this recipe, we will create an app that takes a String from a text field and stores it securely...