Skip to content
pubscout

sqflite

2.4.6, released 10 days ago by tekartik.com

SQLite plugin for Flutter supporting iOS, Android and MacOS.

Flutter FavoriteWASM-readyRock solid
$ flutter pub add sqflite
Source repository

What it does

Provides a self-contained, embedded SQL database engine for Flutter applications. Offers helpers for insert, query, update, and delete operations along with transaction and batch support.

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

Use it when

  • You need a robust relational database with complex SQL queries on device.
  • You want support for transactions and batch operations.
  • You are targeting iOS, Android, and macOS platforms natively.

Skip it when

  • You are looking for a simple key-value store without SQL queries.
  • You prefer compile-time safe database queries via code generation.

Strengths

  • Mature and widely used in the Flutter ecosystem.
  • Supports transactions and batch execution for performance.
  • Executes database operations in a background thread on iOS and Android.

Weaknesses

  • Concurrent read and write transactions are not supported due to SQLite limitations.
  • Does not support complex types like DateTime or bool natively out of the box.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
5

Add to pubspec.yaml via flutter pub add sqflite. Linux, Windows, and Web require additional packages like sqflite_common_ffi or sqflite_common_ffi_web.

import 'package:sqflite/sqflite.dart';

var db = await openDatabase('my_db.db');
await db.transaction((txn) async {
  int id1 = await txn.rawInsert('INSERT INTO Test(name, value, num) VALUES("some name", 1234, 456.789)');
});
await db.close();

Alternatives

Packages that do the same job and could replace sqflite.

Works with

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