Introducing the Realm Flutter SDK
Rate this announcement
Today, we are pleased to announce the next installment of the Realm Flutter SDK – now with support for Windows, macOS, iOS, and Android. This release gives you the ability to use Realm in any of your Flutter or Dart projects regardless of the version.
Realm is a simple super-fast, object-oriented database for mobile applications that does not require an ORM layer or any glue code to work with your data layer. With Realm, working with your data is as simple as interacting with objects from your data model. Any updates to the underlying data store will automatically update your objects as soon as the state on disk has changed, enabling you to automatically refresh the view via StatefulWidgets and Streams.
Flutter has been a boon to developers across the globe, a framework designed for all platforms: iOS, Android, server and desktop. It enables a developer to write code once and deploy to multiple platforms. Optimizing for performance across multiple platforms that use different rendering engines and creating a single hot reload that work across all platforms is not an easy feat, but the Flutter and Dart teams have done an amazing job. It’s not surprising therefore that Flutter support is our top request on Github.
Realm’s Core Database is platform independent meaning it is easily transferable to another environment which has enabled us to build SDKs for the most popular mobile development frameworks: iOS with Swift, Android with Kotlin, React Native, Xamarin, Unity, and now Flutter.
Our initial version of the Flutter SDK was tied to a custom-built Flutter engine. It was version-specific and shipped as a means to gather feedback from the community on our Realm APIs. With this latest version, we worked closely with the Flutter and Dart team to integrate with the Dart FFI APIs. Now, developers can use Realm with any version of their Dart or Flutter projects. More importantly though, this official integration will form the underpinning of all our future releases and includes full support from Dart’s null safety functionality. Moving forward, we will continue to closely partner with the Flutter and Dart team to follow best practices and ensure version compatibility.
All of Realm’s SDKs are built on three core concepts:
- An object database that infers the schema from the developers’ class structure – making working with objects as easy as interacting with their data layer. No conversion code necessary
- Live objects so the developer has a simple way to update their UI – integrated with StatefulWidgets and Streams
- A columnar store so that query results return in lightning speed and directly integrate with an idiomatic query language the developer prefers
Realm is a database designed for mobile applications as a replacement for SQLite. It was written from the ground up in C++, so it is not a wrapper around SQLite or any other relational datastore. Designed with the mobile environment in mind, it is lightweight and optimizes for constraints like compute, memory, bandwidth, and battery that do not exist on the server side. Realm uses lazy loading and memory mapping with each object reference pointing directly to the location on disk where the state is stored. This exponentially increases lookup and query speed as it eliminates the loading of state pages of disk space into memory to perform calculations. It also reduces the amount of memory pressure on the device while working with the data layer.
Since Realm is an object database, your schema is defined in the same way you define your object classes. Additionally, Realm delivers a simple and intuitive string-based query system that will feel natural to Flutter developers. No more context switching to SQL to instantiate your schema or looking behind the curtain when an ORM fails to translate your calls into SQL. And because Realm object’s are memory-mapped, a developer can bind an object or query directly to the UI. As soon as changes are made to the state store, they are immediately reflected in the UI. No need to write complex logic to continually recheck whether a state change affects objects or queries bound to the UI and therefore refresh the UI. Realm updates the UI for you.
The Realm Flutter SDK is free, open source and available for you to try out today. While this release is still in Alpha, our development team has done a lot of the heavy lifting to set a solid foundation – with a goal of moving rapidly into Beta and GA later this year. We will look to bring new notification APIs, a migration API, solidify our query system, helper functions for Streams integration, and of course Atlas Device Sync to automatically replicate data to MongoDB Atlas.