localstore
1.4.0, released 3 years ago by humg.edu.vn
JSON file-based storage package providing a persistent repository for a simple NoSQL database.
What it does
Localstore provides a persistent key-value or document-based NoSQL database using JSON files on the device. It supports collections, documents, fetching by ID, deleting, and streams to track collection changes across multiple platforms including Android, iOS, Web, Windows, macOS, and Linux.
AI-written summary of version 1.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a simple NoSQL database using JSON files.
- You want schema-less local persistence that works across mobile, web, and desktop.
- You need streams to listen to collection updates.
Skip it when
- You require complex relational queries, foreign keys, and SQL joins.
- You need advanced high-performance indexing and querying beyond basic CRUD.
Strengths
- Cross-platform support (Android, iOS, Web, Windows, macOS, Linux)
- Schema-less JSON document model
- Stream support for collections
Weaknesses
- Query functionality (like where clauses) is noted as not fully implemented in the changelog
- File-based storage may scale poorly for very large datasets compared to a proper SQL database
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Requires calling WidgetsFlutterBinding.ensureInitialized() in main() before using Localstore.
import 'package:flutter/material.dart';
import 'package:localstore/localstore.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
final db = Localstore.instance;
// Creates new item
Future<void> addItem() async {
final id = db.collection('todos').doc().id;
db.collection('todos').doc(id).set({
'title': 'Todo title',
'done': false
});
}Alternatives
Packages that do the same job and could replace localstore.
- shared_preferences
If you only need simple key-value configuration storage rather than a document-based NoSQL structure.
97Compare - sqflite
If you need a robust relational SQL database with complex querying capabilities.
96Compare - drift
If you want a type-safe SQL database builder with reactive streams for Flutter.
99Compare
Works with
Packages commonly used together with localstore: ones it builds on, ones built on it, and its own family.