PART 5. Flutter Apps 2025 — Local Storage (JSON) & sqflite

Опубликовано: 16 Май 2026
на канале: Drake Patrick Mirembe
59
3

#Flutter #Dart #LocalStorage

Practical guide to local persistence in Flutter: save/restore JSON files, use SharedPreferences for small key-value data, and implement a local SQLite database with sqflite. Includes file I/O with path_provider, JSON encode/decode, a demo saving a settings JSON file, and a small sqflite CRUD example with database versioning and simple queries. Recommended for developers who need offline support or reliable local storage.

Quick facts (short)
• Save small prefs and tiny JSON strings with SharedPreferences.
Cybrosys Technologies

• Read/write JSON files using path_provider + dart:io (app documents/cache directories).
docs.flutter.dev
+1

• Use sqflite for structured, relational data and when you need SQL queries, indexing, or transactions. Current sqflite releases and examples are on pub.dev.
Dart packages
+1

Timestamps
0:00 Intro — when to use JSON files, SharedPreferences, or sqflite
0:30 Quick demo: save/load JSON file with path_provider + dart:io
2:30 Demo: persist small settings with SharedPreferences (jsonEncode/jsonDecode)
4:00 Why and when to choose sqflite — schema, migrations, queries
5:00 Setup sqflite + path, open DB and create table (versioning)
6:30 CRUD example: insert, query, update, delete (simple notes app)
8:30 Best practices: migrations, batching, transactions, background isolates for heavy IO
9:30 Testing and debugging local storage (unit tests, flutter_driver)
10:00 Wrap up — when to choose each solution and next exercises