Getting Started with the Flutter Realm SDK for MongoDB

Suragch
8 min readMar 20, 2023

This tutorial covers local storage only, no Atlas device sync

Fluttering leaves, generated by Dall-E

Normally I use SQLite for storing large amounts of data locally, and the sqflite package has served me well for that. However, I’m now working on a project that will require syncing data across devices, and I have no idea how to calculate the diffs if I want to sync only the parts that were changed. But then just recently, MongoDB started supporting Flutter with its Realm SDK, and they also have an option called Atlas App Services for automatically syncing data across devices. That’s very tempting.

I’ve written recently about my hesitancy to use third-party packages, but this one seems like it might be reliable:

  1. It got an official endorsement by the Dart and Flutter teams at Google.
  2. MongoDB Inc, the company behind MongoDB, is a large, well-known company with a long history.

In this article, I’ll describe how to perform basic CRUD operations in local storage. Since it’s a first look at MongoDB, I won’t cover how to sync data across devices. If I write that tutorial later, I’ll link to it from here. This tutorial will essentially be a replacement for SQLite local storage.

SQLite vs. MongoDB

--

--