BlogAtlas Vector Search voted most loved vector database in 2024 Retool State of AI reportLearn more >>
MongoDB Developer
Sign in to follow topics
MongoDB Developer Centerchevron-right
Developer Topicschevron-right

Announcing the GA of the Realm Flutter SDK

Ian Ward6 min read • Published Feb 09, 2023 • Updated Jun 14, 2023
Facebook Icontwitter iconlinkedin icon
Rate this article
After over a year since our first official release, we are excited to announce the general availability of our Realm Flutter SDK. The team has made dozens of releases, merged hundreds of PRs, and squashed thousands of bugs — many of them raised by you, our community, that has guided us through this preview period. We could not have done it without your feedback and testing. The team also worked in close partnership with the Dart and Google Cloud teams to make sure our Flutter SDK followed best practices. Their guidance was essential to stabilizing our low-level API for 1.0. You can read more about our collaboration with the Dart team on their blog here.
Realm is a simple and 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.
With this 1.0 release we have solidified the foundation of our Realm Flutter SDK and stabilized the API in addition to adding features around schema definitions such as support for migrations and new types like lists of primitives, embedded objects, sets, and a RealmValue type, which can contain a mix of any valid type. We’ve also enhanced the API to support asynchronous writes and frozen objects as well as introducing a writeCopy API for converting realm files in code bringing it up to par with our other SDKs.
Finally, the Realm Flutter SDK comes with built-in data synchronization to MongoDB Atlas — a cloud-managed database-as-a-service for MongoDB. The developer does not need to write any networking or conflict resolution code. All data transfer is done under the hood, abstracting away thousands of lines of code for handling offline state and network availability, and enabling developers to build reactive mobile apps that can trigger UI updates automatically from server-side state changes. This delivers a performant and offline-tolerant mobile app because it always renders the state from disk.
Live-code with us
Join us live to build a Flutter mobile app from scratch! Senior Software Engineer Kasper Nielsen walks us through setting up a new Flutter app with local storage via Realm and cloud-syncing via Atlas Device Sync. Register here.

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 pages of data into memory to perform calculations. It also reduces the amount of memory pressure on the device while working with the data layer.
Build better mobile apps with Atlas Device Sync: Atlas Device Sync is a fully-managed mobile backend as a service. Leverage out-of-the-box infrastructure, data synchronization capabilities, built-in network handling, and much more to quickly launch enterprise-grade mobile apps. Get started now by build: Deploy Sample for Free!

Enhancements to the Realm Flutter SDK

The greatest enhancements for the GA of the SDK surround the modeling of the schema — giving developers enhanced expressiveness and flexibility when it comes to building your data classes for your application. First, the SDK includes the ability to have embedded objects — this allows you to declare an object as owned by a parent object and attach its lifecycle to the parent. This enables a cascading delete when deleting a parent object because it will also delete any embedded objects. It also frees the developer from writing cleanup code to perform this operation manually. A Set has also been added, which enables a developer to have a collection of any type of elements where uniqueness is automatically enforced along with a variety of methods that can operate on a set. Finally, the flexibility is further enhanced with the addition of RealmValue, which is a mixed type that allows a developer to insert any valid type into the collection or field. This is useful when the developer may not know the type of a value that they are receiving from an API but needs to store it for later manipulation.
The new SDK also contains ergonomic improvements to the API to make manipulating the data and integrating into the Flutter ecosystem seamless. The writeCopy API allows you to make a copy of a Realm database file to bundle with your application install and enables you to convert from a non-sync to sync with Realm and vice versa. Frozen objects give developers the option to make a snapshot of the state at a certain point in time, making it simple to integrate into a unidirectional data flow pattern or library such as BLoC. Lastly, the writeAsync API introduces a convenient method to offload work to the background and preserve execution of the main thread.

Looking ahead

The Realm Flutter SDK is free, open source, and available for you today. We believe that with the GA of the SDK, Flutter developers can easily build an application that seamlessly integrates into Dart’s language primitives and have the confidence to launch their app to production. Thousands of developers have already tried the SDK and many have already shipped their app to the public. Two such companies are Aupair Valley and Dot On.
Aupair Valley is a mobile social media platform that helps connect families and au pairs worldwide. The app’s advanced search algorithm facilitates the matching between families and au pairs. They can find and connect with each other and view information about their background. The app also enables chat functionality to set up a meeting. Aupair Valley selected Flutter so that they could easily iterate on both an Android and iOS app in the same codebase, while Realm and Device Sync played an essential role in the development of Aupair Valley by abstracting away the data layer and networking that any two-sided market app requires. Built on Google Cloud and MongoDB Atlas, Aupair Valley drastically reduced development time and costs by leveraging built-in functionality on these platforms.
Dot On is a pioneering SaaS Composable Commerce Platform for small and midsize enterprises, spanning Product Management and Order Workflow Automation applications. Native connectors with Brightpearl by Sage and Shopify Plus further enrich capabilities around global data syndication and process automation through purpose-built, deep integrations. With Dot On’s visionary platform, brands are empowered with digital freedom to deliver exceptional and unique customer experiences that exceed expectations in this accelerating digital world.
Dot On chose Realm and MongoDB Atlas for their exceptional and innovative technology fused with customer success that is central to Dot On’s core values. To meet this high bar, it was essential to select a vendor whose native-application database solution was tried and tested, highly scalable, and housed great flexibility around data architecture all while maintaining very high standards over security, privacy and compliance.
“Realm and Device Sync is a perfect fit and has accelerated our development. Dot On’s future is incredibly exciting and we look forward to our continued relationship with MongoDB who have been highly supportive from day one.” -Jon Petrie, CEO, Dot On.
The future is bright for Flutter at Realm and MongoDB. Our roadmap will continue to evolve by adding new types such as Decimal128 and Maps, along with additional MongoDB data access APIs, and deepening our integration into the Flutter framework with guidance and convenience APIs for even simpler integrations into state management and streams. Stay tuned!
Give it a try today and let us know what you think! Check out our samples, read our docs, and follow our repo.
Live-code with us
Join us live to build a Flutter mobile app from scratch! Senior Software Engineer Kasper Nielsen walks us through setting up a new Flutter app with local storage via Realm and cloud-syncing via Atlas Device Sync. Register here.

Facebook Icontwitter iconlinkedin icon
Rate this article
News & Announcements

Introducing Flexible Sync (Preview) – The Next Iteration of Realm Sync

Oct 19, 2022 | 7 min read
News & Announcements

Realm Core Database 6.0: A New Architecture and Frozen Objects

Oct 19, 2022 | 3 min read

New Realm Cocoa Data Types

Mar 06, 2023 | 4 min read

Continuously Building and Hosting our Swift DocC Documentation using Github Actions and Netlify

May 10, 2022 | 6 min read
Table of Contents
  • Why Realm?