Skip to content
pubscout

sqlite3

3.9.1, released 12 days ago by simonbinder.eu

Lightweight and convenient SQLite bindings for Dart using dart:ffi

Rock solid
$ flutter pub add sqlite3
Source repository

What it does

Provides direct and synchronous access to SQLite databases on native platforms and the web. It bundles SQLite using hooks, avoiding external build configurations for most apps, and supports virtual file systems on the web.

AI-written summary of version 3.9.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need direct, low-level SQL database operations in Dart or Flutter.
  • You want cross-platform SQLite support including native platforms and the web.

Skip it when

  • You prefer an ORM or type-safe query builders.
  • You need an asynchronous database driver out-of-the-box without manual isolate management.

Strengths

  • Bundles SQLite using hooks so no external dependencies are needed.
  • Supports web through WebAssembly and virtual file systems.
  • Provides both native and web APIs as well as a common shared interface.

Weaknesses

  • Operates synchronously on the main thread by default, requiring manual background isolates for optimal performance in large apps.
  • Web setup requires downloading and hosting a separate WebAssembly module.

Setup

Kind
FFI (native library)
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
10

Simply add the dependency via pub. For web usage, a sqlite3.wasm file must be provided and loaded manually.

import 'package:sqlite3/sqlite3.dart';

void main() {
  final db = sqlite3.open('test.db');
  db.execute('CREATE TABLE users (id INTEGER NOT NULL PRIMARY KEY, name TEXT) STRICT');
  db.execute('INSERT INTO users (name) VALUES (?)', ['SQLite user']);
  print(db.select('SELECT * FROM users'));
}

Alternatives

Packages that do the same job and could replace sqlite3.

  • sqflite

    Sqflite is the classic asynchronous SQLite plugin designed specifically for Flutter.

  • hive_ce

    Hive CE is a lightweight key-value database if you do not need the full power of SQL.

Works with

Packages commonly used together with sqlite3: ones it builds on, ones built on it, and its own family.