Flutter databases are databases specifically designed to give Flutter / Dart apps fast data persistence. Other databases can be used depending on the database and use case, but in our experience Flutter databases are easier to use and faster in Flutter/Dart apps. Note: Because “Dart” is such an ambiguous term, “Flutter database” is the established terminology (even though from a tech perspective it is not a great name).
As a Flutter app developer, selecting the right local database is important. After a market overview and terminology, we’ll compare the most popular options (ObjectBox, sqflite, Drift, Floor, Isar, Sembast, Realm) in a matrix.
Flutter is here to stay
Flutter, Google’s open source multi-platform application framework, has gained quite some popularity over the years. In May 2023 there were over 1 million published Flutter-based apps, up from 500,000 in mid-2022. In 2021 it was already the most popular cross-platform mobile frameworks used by developers worldwide according to Statista. The Flutter framework uses Dart as the programming language, which was first released in 2011. Despite Dart being such a young language, it made it already to spot 28 on the Tiobe index (May 2023). While the majority of mobile developers still used native tools in 2022, Flutter has gained quite some traction and is a serious developer platform today. Accordingly, Flutter databases are gaining momentum too and in the following we’re looking into the Flutter database landscape.
Flutter databases / Flutter Dart data persistence
While the database market is huge and dynamic, there are only a few Flutter databases options to choose from if you are a Flutter / Dart app developer. Before we dive into the Flutter database options, advantages and disadvantages, we’re taking a very quick look at databases to make sure we share a common ground.
What is a database?
A database is a piece of software that allows the storage and systematic use of digital information, in other words: data persistence. As opposed to mere caching, data is reliably stored and available to work with unless actively deleted. A database allows developers to store, access, search, update, query, and otherwise manipulate data via a developer language or API. These types of operations are done within an application, in the background, typically hidden from end users. Many applications need a database as part of their technology stack. The most typical database operations are CRUD: Create, Read, Update, Delete.
What are the major types of databases?
There are many types of databases. For our purpose, the most important differentiations are non-relational (NoSQL) versus relational databases (SQL), cloud databases versus edge databases, and maybe embedded versus in-memory. However, databases can be further distinguished by additional criteria e.g. the data types they support, or the way they scale – and definitions can vary.
What is an ORM?
An Object relational Mapper (ORM) is not a database. We’re bringing this up mainly, because we see it confused often. It is a layer that sits on top of a database and makes it easier to use. This is typically especially relevant when the database is a relational database (SQL) and the programming language used is object-oriented. As noted above, Dart is an object-oriented programming language.
The Flutter database landscape
The database landscape for Flutter Dart is limited. So, let us quickly introduce the handful of current market players.
- Drift (formerly known as Moor) is an ORM on top of SQLite, so in itself it isn’t a database really. SQLite is a long-established lightweight relational (SQL) database.
- Floor is an ORM on top of SQLite too.
- Isar is a fast lightweight NoSQL database written by the author of hive.
- ObjectBox DB is a fast lightweight NoSQL database with an integrated Data Sync.
- Realm is a fairly lightweight NoSQL database written primarily in Java and acquired by Mongo DB in spring 2019.
- Sembast is a NoSQL database
- sqflite is a wrapper around SQLite, which is a relational database without direct support for Dart objects.
Note: As Hive will be deprecated (according to its author) and Isar is the new thing, we are covering only Isar.
What is the best Flutter database?
This of course depends… Make up your own mind with the following comparison matrix as a starting point. If you’re on mobile, use this link to view the table.
|Data persistence||Description||Primary Model||Data Sync||Language||License||Fun Fact||"Headquarter"|
|Drift||ORM on top of SQLite||relational||❌||SQL||SQLite is public domain, Drift is MIT||Formerly known as Moor||🇩🇪|
|Floor||ORM on top of SQLite||relational||❌||SQL||SQLite is public domain, floor is Apache 2.0||Developed by a mobile app agency, not an individual author||🇳🇱|
|Isar||Lightweight NoSQL database||NoSQL||❌||Dart||Apache 2.0||Author of hive, which will be deprecated||🇩🇪|
|ObjectBox||Lightweight NoSQL database with integrated Data Sync||NoSQL||✅||Dart||Bindings are Apache 2.0||It is used in BMW cars 😮||🇩🇪|
|Realm||NoSQL database acquired by Mongo DB in spring 2019, Flutter binding came in 2023||NoSQL||Yes, but you need to use MongoDB Atlas and the Mongo DB Cloud||Dart||Apache 2.0||Originally Realm was developed in Denmark…||🇺🇸|
|Sembast||NoSQL database, fully document-based||NoSQL||❌||Dart||BSD-3-Clause||Also the author of SQFlite||🇫🇷|
|sqflite||SQLite plugin for Flutter||relational||❌||SQL||SQLite is public domain, sqflite lib is MIT||Not an ORM||🇫🇷|
We added the “headquarter” (basically “country of origin” as it is mostly individual authors) because our research showed that the Flutter database market is very European – very unlike the typical database landscape. We found this astonishing. As far as we know, the Flutter database market is not specifically funded (no VC-funding), unlike the vector database market, graph database market, time series database market, and every other classic database market. Mongo DB was heavily funded in the NoSQL database market, but they have long since IPOd… From our experience and view of the database market, many database companies that originated in Europe or had European founders moved their headquarters (and most importantly their IP) to the US, usually in conjunction with a funding round. So, this strong European base may be due to a lack of specific funding – the real question then is: Why is there no specific funding for that market?
Flutter Database landscape
Flutter has become a serious developer platform in 2022 and developers need a local data persistence solution (as in “Flutter database”). There are more and more databases supporting the Flutter community, but few have the traction to be notable yet (we selected primarily by pub.dev likes). However, the Flutter database market will stay an interesting one in 2023… If you want to learn more about the database space, DB-engines and the database of databases are great starting points.