Realm
MongoDB Developer Centerchevron-right
Developer Topicschevron-right
Productschevron-right
Realmchevron-right

Introducing the Realm Flutter SDK

Ian WardPublished Jan 31, 2022 • Updated Sep 02, 2022
FlutterRealmSDKDart
Copy Link
facebook icontwitter iconlinkedin icon
random alt
Rate this announcement
star-empty
star-empty
star-empty
star-empty
star-empty
This article discusses the alpha version of the Realm Flutter SDK which is now in beta with more features and functionality. Learn more here."
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.

Introduction

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.

Why Realm

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.

Realm for Flutter Developers

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.

Looking Ahead

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.
Give it a try today and let us know what you think! Check out our samples, read our docs, and follow our repo.

Copy Link
facebook icontwitter iconlinkedin icon
Rate this announcement
star-empty
star-empty
star-empty
star-empty
star-empty
Related
Tutorial
Introduction to the Realm SDK for Android

Sep 23, 2022
Code Example
Build Offline-First Mobile Apps by Caching API Results in Realm

May 13, 2022
Quickstart
Unboxing Jetpack Compose: My First Compose App

May 09, 2022
Article
A Preview of Flexible Sync

Sep 02, 2022
Table of Contents
  • Introduction