Skip to content
pubscout

realm_dart

20.2.0, released a year ago by realm.io

Official Realm database SDK for Flutter and Dart to store and query objects locally.

Quiet but busy
$ flutter pub add realm_dart
Source repository

What it does

Realm is an object-oriented mobile database that runs directly inside mobile, tablet, and desktop devices. It provides schema validation via code generation, fast querying capabilities, and reactive streams for data changes.

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

Use it when

  • You need a fast, local NoSQL object database for Flutter or Dart applications.
  • You require reactive streams of query results to update your UI automatically when data changes.
  • You want a rich querying language without writing raw SQL.

Skip it when

  • You are looking for built-in Atlas Device Sync or backend synchronization features, as they were deprecated and removed in version 20.0.0.
  • You prefer a lightweight key-value store like SharedPreferences for simple configuration settings.

Strengths

  • Faster than raw SQLite on many common operations.
  • Object-oriented data model without needing a traditional ORM.
  • Built-in support for listening to changes on query results.

Weaknesses

  • Requires code generation steps using build tools and native binary installations.
  • Atlas Device Sync features have been deprecated and removed.

Setup

Kind
FFI (native library)
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
22

Requires adding the dependency, running 'dart run realm generate' (or 'realm_dart generate') for codegen, and installing native binaries using 'dart run realm install'. Minimum Flutter version 3.10.2 or Dart 3.0.2.

var config = Configuration.local([Car.schema]);
var realm = Realm(config);
var car = Car("Tesla", "Model Y", kilometers: 5);
realm.write(() {
  realm.add(car);
});
var cars = realm.all<Car>();

Alternatives

Packages that do the same job and could replace realm_dart.

  • sqflite

    If you prefer working with traditional relational SQLite databases using SQL statements.

  • drift

    If you want a reactive, type-safe SQLite database builder for Dart and Flutter.

  • hive_ce

    If you need a pure Dart lightweight NoSQL key-value database without native binary dependencies.

Works with

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