idb_sqflite
1.5.3, released 11 days ago by tekartik.com
IndexedDB API implementation on top of sqflite for Flutter and Dart VM
WASM-ready
What it does
Provides an IndexedDB-compatible database interface built on top of sqflite, enabling code to use IndexedDB patterns across mobile, web, and desktop platforms. It also includes a simplified wrapper API called SDB.
AI-written summary of version 1.5.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need an IndexedDB-compatible API sharing code across web, mobile, and desktop
- You want to store structured data locally using sqflite as the backend engine
Skip it when
- You need a high-performance native ORM or complex relational SQL queries
- You prefer standard sqflite or drift APIs over IndexedDB concepts
Strengths
- Brings IndexedDB API support to mobile and desktop via sqflite
- Works across Android, iOS, Web, Windows, macOS, and Linux
Weaknesses
- Performance is constrained by running an IndexedDB emulation layer over SQLite
- API style follows IndexedDB rather than native Dart/SQL idioms
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
import 'package:idb_sqflite/idb_sqflite.dart';
import 'package:sqflite/sqflite.dart';
Future main() async {
var factory = getIdbFactorySqflite(databaseFactory);
const String storeName = "records";
Database db = await factory.open("my_records.db", version: 1,
onUpgradeNeeded: (VersionChangeEvent event) {
Database db = event.database;
db.createObjectStore(storeName, autoIncrement: true);
});
var txn = db.transaction(storeName, idbModeReadWrite);
var store = txn.objectStore(storeName);
var key = await store.put({"some": "data"});
await txn.completed;
}Alternatives
Packages that do the same job and could replace idb_sqflite.
Works with
Packages commonly used together with idb_sqflite: ones it builds on, ones built on it, and its own family.
- synchronizedidb_sqflite depends on itLock mechanism to prevent concurrent access to asynchronous code.
- sqflite_commonidb_sqflite depends on itDart wrapper on SQLite providing the common API for sqflite and desktop FFI implementations.
- idb_shimidb_sqflite depends on itCross-platform IndexedDB implementation for Dart and Flutter.
- sqfliteSame familySQLite plugin for Flutter supporting iOS, Android and MacOS.
- sqflite_common_ffiSame familyFFI-based implementation of sqflite for desktop platforms and unit tests.
- sembastSame familyA NoSQL persistent embedded document-based database for Dart and Flutter.
- process_runSame familyRun shell scripts and locate executables across Linux, Windows and macOS.
- sqflite_common_ffi_webSame familySqflite web implementation using sqlite3 ffi and sqlite3 wasm.