4min. read

Demystifying Flutter's Local Database Options: A Comprehensive Summary

A summary of key features of SQLite libraries (sqflite, sqlite3, sqlite_async), SQLite wrappers (Floor, Drift), made-for-Flutter NoSQL databases (Isar, Sembast) and other NoSQL databases (Realm, ObjectBox) that can be used for Flutter apps.

Photo of Phillip van der Merwe
By Phillip van der Merwe
Featured image for "Demystifying Flutter's Local Database Options: A Comprehensive Summary"

Since we couldn’t find any easy to understand and up-to-date summary of local database options for Flutter, we created one ourselves. The table below shows the main options available with key features that should help you decide which local database will work best for you. Feedback and suggestions welcome!

Notes

Full database functionality

This summary includes only local database options that provide full database functionality (persistent, consistent and queryable data stores). We’ve ignored overly simplistic databases or caches. For example, we haven’t included shared_preferences or hive because they’re built for basic key-value storage.

Standalone

We’ve also only included local databases that can be implemented standalone. For example, since Firebase’s local data store can only be used in conjunction with the Firebase backend-as-a-service offering, it has not been included.

Open source

All listed databases are open source.

Cross-platform

All listed databases can support iOS, Android, MacOS, Windows and Linux. Web support is noted separately in the table.

Summary Table of Flutter Local Databases

Database / PackageDescriptionTypePerformance CategoryAsynchronous by Default?ConcurrencyEncryption SupportWeb SupportQuery MethodPlug-in Cloud Sync Support?Backend Database Type
SQLite – sqfliteThe original SQLite integration for Flutter, using a plugin package.SQLiteLimited optimization possibilitiesYesSingle transaction at a timeYes (via SQLCipher)ExperimentalSQLNo-
SQLite – sqlite3Low-level library exposing SQLite C APIs to Dart code using an FFI plugin package.SQLiteRequires manual optimizationNo - requires additional work to run in background IsolatesNo built-in support, but can run operations on background isolates with extra workYes (via SQLCipher)ExperimentalSQLNo-
SQLite – sqlite_asyncModified sqlite3 to add performance optimizations and asynchronous calls by default.SQLiteHigh-performanceYesBuilt-in support for one write transaction and multiple read transactions concurrentlyYes (via SQLCipher)No (experimental support can be added similar to sqlite3)SQLYes, when used as part of PowerSyncSQL
FloorSQLite ORM built on top of the sqflite library and inspired by Android’s Room persistence library.SQLiteLimited optimization possibilitiesYesSingle transaction at a timeYes (via SQLCipher)NoSQLNo-
DriftSQLite ORM built on top of the sqlite3 library (by the same author).SQLiteHigh-performanceYesConnection pool can be used for one write transaction and multiple read transactions concurrentlyYes (via SQLCipher)ExperimentalORM but with “SQL parsing” capabilitiesNo-
IsarNoSQL database made for Flutter (written by hive author with the intention to supersede hive).NoSQLHigh-performanceYes (has equivalent synchronous and asynchronous APIs for most operations)Built-in support for one write transaction and multiple read transactions concurrentlyYesFull support seems to be in the works. See open issue and documented limitations.Domain-specificNo-
SembastNoSQL database made for Flutter “for single process io applications”.NoSQLUnknownYesUnknownYesYes, through a separate packageDomain-specificNo-
MimirNoSQL database made for Flutter with heavy-weight full-text search capabilities thanks to Meilisearch.NoSQLUnknownYesUnknownYesNoDomain-specificNo-
RealmNoSQL “mobile database” acquired by MongoDB.NoSQLHigh-performanceNo, but has partial async supportSupport for concurrent transactions when using separate IsolatesYesNoDomain-specificYes through MongoDB Atlas Device SyncHosted MongoDB Atlas (NoSQL)
ObjectBoxNoSQL “edge database” seemingly built with IoT use cases in mind including sync to self-hosted sync server.NoSQLHigh-performanceNo, but makes asynchronous operations easy from version 2.0Built-in support for one write transaction and multiple read transactions concurrentlyNoNoDomain-specificYes, to self-hosted ObjectBox Sync ServerSelf-hosted ObjectBox Sync Server (NoSQL)
MoorRenamed to Drift

Notes On Table Columns

Type

Indicates whether the database is SQLite or NoSQL.

Performance Category

Once a database has been optimized for performance, it will generally meet high performance standards (see our separate post on comparing database performance that partly led us to this conclusion). For this reason, databases have been grouped into one of three performance categories:

  1. Limited optimization possibilities (for example sqflite which cannot provide access to low-level high-performance SQLite APIs because it is not an FFI package).
  2. Requires manual optimization (where optimization is possible but must be done manually by the developer themselves).
  3. High-performance (where the database is set up to be highly performant by default).

Asynchronous by Default

This indicates whether the database supports asynchronous operations; in other words, whether there is multi-isolate support that prevents the main isolate from being blocked.

Concurrency

Here we list the database’s ability to support multiple concurrent transactions.

Web Support

Here most SQLite are listed as experimental as their web support is based on SQLite’s WebAssembly implementation which is not yet broadly supported by web browsers.

Query Method

Here the query methods are "SQL" or "ORM" for SQLite-based databases and "domain-specific" for NoSQL databases since they each have their own query flavor.

Plug-In Cloud Sync Support

This refers to the database’s ability to plug into an existing sync system that keeps data in sync with a primary cloud database and across devices.

Backend Database Type

This indicates the cloud database type that the cloud sync solution supports.

Feedback

If you have feedback on this summary or have a suggestion for a feature to include, please let us know on twitter @powersync_ .