Learn to store data on the device so your Flutter app works offline and remembers state between launches. You will use shared_preferences for settings, sqflite for relational data and Hive for fast object storage, then wrap them in a repository that caches API data and picks the right store for each job.
Watch the free preview
Getting started with shared_preferences — free to watch, no account needed.
What you'll learn
- Store data on the device for offline use across app launches
- Persist simple settings and flags with shared_preferences
- Model and query relational data with sqflite, including migrations
- Store objects fast with Hive using type adapters
- Wrap local stores in a repository that caches API data and chooses the right store
Syllabus
Simple Settings with shared_preferences
Getting started with shared_preferencesFree preview
Managing typed preferences safely
Relational Data with sqflite
Opening a database and creating tables
CRUD, queries and migrations
Fast Object Storage with Hive
Hive basics — boxes and key-value storage
Type adapters — storing your own objects
Architecture — Repositories and Caching
The repository pattern for local data
Caching API data and choosing the right store
Lab — 10 Exercises & Solutions
Exercises 1–5
Exercises 6–10