v1.4.0
localstore
基於 JSON 檔案的儲存套件為簡單的 NoSQL 資料庫提供持久性儲存庫。
194喜歡 2270近 30 天下載140Pub 分數
AndroidiOSWebmacOSWindowsLinux
chuyentt/localstore open-source repository details.
{"sdk":"flutter"}^1.8.2^2.0.11{"sdk":"flutter"}^3.0.2^5.0.0^3.0.0^2.1.2^2.1.8以下為英文專案原文快照,最新內容請造訪 GitHub。
Between SQL or NoSQL, there's no one best database, there's the right database for your specific project. Localstore is a JSON file-based storage package (localstorage) provides a persistent repository for simple NoSQL database.
| Localstore (NoSQL) | SQLite (SQL) | |
|---|---|---|
| Data format | File path (collection) | Table |
| Data item | JSON Document (doc) | Record / Row |
| Scalability | Horizontal | Limited vertical |
| Organization | Schema-less | Fixed schema |
Localstore UML diagram
WidgetsFlutterBinding.ensureInitialized(); in main() before calling runApp():void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
import 'package:localstore/localstore.dart';import 'package:flutter/material.dart';
import 'package:localstore/localstore.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
Localstorefinal db = Localstore.instance;
or using anywhere in your project.
// gets new id
final id = db.collection('todos').doc().id;
// save the item
db.collection('todos').doc(id).set({
'title': 'Todo title',
'done': false
});
final data = await db.collection('todos').doc(id).get();
db.collection('todos').doc(id).delete();
final items = await db.collection('todos').get();
final stream = db.collection('todos').stream;
Please file feature requests and bugs at the issue tracker.