skip to Main Content

I am creating flutter desktop app with local mysql database. How to do secure the db creds so that it is not easily accesible. Is there a secure way to store db credentials?

2

Answers


  1. You can do this by calling the getInstance() method: SharedPreferences prefs = await SharedPreferences. getInstance(); Once you have an instance of SharedPreferences , you can use it to store data using the set method.

    Login or Signup to reply.
  2. Prateek’s answer is fine for non secret items, but not for credentials. In windows, shared preferences are stored as plain text in your appData folder. With credentials you should look for: https://pub.dev/packages/flutter_secure_storage

    You will find examples there.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search