Docs Menu

Docs HomeRealm

Install Realm - Flutter SDK

On this page

  • Prerequisites
  • Installation
  • Create a Flutter Project
  • Add Realm to the Project
  • Import Realm Package
  • Dart Standalone Installation
  • Create a Dart Project
  • Add Realm to the Project
  • Install Realm into Application
  • Import Realm Package
  • Update Package Version
  • Install Flutter in your development environment. To use the latest version of the Realm SDK, you must use Flutter version 3.0.3 or later and Dart version 2.17.5 or later.

Warning

Incompatible with Dart 2.17.3

The Realm Flutter SDK and Realm Dart Standalone SDK are not compatible with Dart 2.17.3 due to an issue with the Dart virtual machine in this version. You may use Dart 2.17.5 version or later with Realm.

Follow these steps to add the Realm Flutter SDK to your Flutter project.

Note

Use Realm with Only Dart

In addition to using Realm with Flutter, you can also use Realm only with Dart, like a CLI application or web server.

The usage for Realm with Dart is the same as the Flutter SDK, except you must install and set up a separate package.

Learn how to set up Realm in your Dart project.

1

Create a Flutter project. Follow the instructions in the Flutter documentation.

flutter create <app_name>
cd <app_name>
2

To add the Realm Flutter SDK to your project, run the command:

flutter pub add realm

This downloads the realm package and adds it to your project. In your pubspec.yaml file, you should see:

pubspec.yaml
dependencies:
realm: <latest_version>
3

To use the Realm Flutter SDK within your app, import the package into files where you will use it:

import 'package:realm/realm.dart';

Note

Using Networking in your macOS App

If you are developing with the Realm Flutter SDK in the macOS App Sandbox, network requests do not work by default due to built-in macOS security settings. To fix this, you must change the Flutter app's macOS network entitlements.

To learn how to do this, refer to Use Realm with the macOS App Sandbox.

To use Realm with Dart but not Flutter, there is a separate Dart SDK package with its own installation process. The Dart SDK can be used for CLI applications or when running Dart in a server environment. The Dart standalone package realm_dart has the same usage as the Flutter package except where otherwise noted.

1

Create a Dart project.

Note

Using Dart without Flutter

The official Dart docs have helpful getting started material for using Dart without Flutter for CLI and server use cases.

See the official documentation.

2

To add the Realm Dart SDK to your project, run the command:

dart pub add realm_dart

This downloads the realm_dart package and adds it to your project. In your pubspec.yaml file, you should see:

pubspec.yaml
dependencies:
realm_dart: <latest_version>
3

Install the realm_dart package into the application. This downloads and copies the required native binaries to the app directory.

dart run realm_dart install
4

To use the Realm Dart SDK within your app, import the package into files where you will use it:

import 'package:realm_dart/realm.dart';

To change the version of the Flutter SDK or Dart Standalone SDK in your project, follow these steps.

←  Realm Flutter SDK (Release Candidate)Quick Start - Flutter SDK →
Share Feedback
© 2023 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.