Local Data Options

Choose storage by durability, query needs, target platforms, privacy, and migration cost.

Decision Table

NeedStart withWatch for
Tiny preferencesshared_preferencesPrimitive types only, not guaranteed durable enough for critical data
User files or exportspath_provider plus dart:ioNot the same recipe on web
Relational local data on Android/iOS/macOSsqfliteRecipe support does not cover every desktop/web target
Cross-platform relational app dataEvaluate Drift/sqlite3/FFI/Web optionsPlatform-specific setup and migrations
Sensitive dataSecure storage plus encrypted backup designKey recovery and platform secure-store differences
Offline-first syncLocal source of truth plus mutation queueConflict rules, idempotency, observability

Use a separate decision matrix instead of one universal default. For small settings, use key-value storage. For real app records, use a database. For web parity, verify the storage package’s web implementation before committing.

Questions Before Choosing

  1. Does the app need queryable records or just preferences?
  2. Must data survive uninstall, migration, export, or backup?
  3. Is web a first-class target?
  4. Does the data need encryption at rest?
  5. Will the app sync later, or is export/import enough?

Gotcha: Local storage choices become product choices. Backup, export, restore, migration, and account recovery matter more than which package is fashionable.