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.
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.
96Compare - drift
If you want a reactive, type-safe SQLite database builder for Dart and Flutter.
99Compare - hive_ce
If you need a pure Dart lightweight NoSQL key-value database without native binary dependencies.
96Compare
Works with
Packages commonly used together with realm_dart: ones it builds on, ones built on it, and its own family.
- cryptorealm_dart depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- pub_semverrealm_dart depends on itVersions and version constraints implementing pub's versioning policy.
- package_configrealm_dart depends on itRead and write Dart package configuration files.
- pubspec_parserealm_dart depends on itParse pubspec.yaml files with a type‑safe API and detailed error reporting.
- ffirealm_dart depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- json_annotationrealm_dart depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- argsrealm_dart depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- loggingrealm_dart depends on itProvides configurable logging with levels and stream listeners for Dart apps.