A user in Wa opens your app with no data left on her bundle. If everything comes from the server, she sees an empty screen. If your app stored what it needs on the phone, she sees her records straight away. Storing data on the device is what makes apps feel fast and reliable on Ghanaian networks, and an agritech advert we read named offline storage explicitly.
Three kinds of data, three tools
1. Small settings: key value storage. For simple things like "dark mode on", "language is English" or "last selected branch", use the shared_preferences package. You save a value under a key and read it back later.
final prefs = await SharedPreferences.getInstance();
await prefs.setString('language', 'en');
final lang = prefs.getString('language') ?? 'en';It is easy, but it is not a database. Do not store long lists or important records in it.
2. Structured records: a database. For lists of products, sales, survey answers or messages, use a real database on the phone. SQLite is a small, reliable database built into Android. In Flutter the sqflite package gives you access to it, and packages such as Drift add type safety on top. Records live in tables with columns, and you query them with SQL: