What is the difference between SharedPrefernces and Flutter_secure_storage packages when building an app in flutter? or do they do the same thing?

2,417

flutter_secure_storage package uses SharedPreferences with MODE_PRIVATE as you can see here:

preferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);

It also uses additional encryption via AES. From readme: AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in KeyStore. You can find details in the source code.

As for secure tokens and other sensitive data, it would be safer to use flutter_secure_storage instead of raw SharedPreferences with private mode.

Share:
2,417
Ugocode
Author by

Ugocode

Updated on December 27, 2022

Comments

  • Ugocode
    Ugocode over 1 year

    I am trying to build an app in flutter using api tokens and i would like to know if SharedPrefences and flutter_secure_storage packages do the same things or if they are different.