📱 Flutter Intermediate

What is SharedPreferences in Flutter?

Why Interviewers Ask This

This question targets practical, hands-on experience with Flutter. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.

Answer

SharedPreferences is a Flutter plugin for persisting simple key-value data on the device. It supports bool, int, double, String, and List<String>. It uses NSUserDefaults on iOS and SharedPreferences on Android under the hood. Usage: final prefs = await SharedPreferences.getInstance(); prefs.setString("token", token);. It is asynchronous and persists data across app restarts. Do not store sensitive data like passwords here — use flutter_secure_storage instead.

Pro Tip

Back up your answer with a specific project or situation. Saying 'In my last Flutter project, I used this when...' immediately makes your answer more credible and memorable.