Install Atlas Device SDK for Flutter
On this page
Use Atlas Device SDK in a Flutter project to build cross-platform applications with Flutter and Dart. This guide provides instructions for installing the SDK in a Flutter project. For details about installing the SDK in a standalone Dart project, refer to Install Atlas Device SDK.
Requirements
Install Flutter with Dart in your development environment. The Flutter installation includes Dart. To learn how, refer to the official Flutter Installation Guide.
When building a project with Flutter, the SDK requires the following minimum versions:
Flutter version 3.19.0 or later.
Dart version 3.3.0 or later.
Supported Platforms
When using the SDK in a Flutter or standalone Dart project, you can build for the following platforms:
iOS
Android
macOS
Windows running on 64-bit architecture
Linux running on 64-bit architecture
Important
Unsupported Platforms
The SDK does not currently support the following platforms through the Dart or Flutter libraries:
Web
Windows running on ARM64 or 32-bit architectures
Linux running on ARM64 or 32-bit architectures
Visit the respective "Build for Platforms" page for more details about library and language support:
Install the SDK
Create a Project
To create a Flutter project, run the following commands:
flutter create <app_name> cd <app_name>
For more information, refer to Flutter's Get Started Guide.
Add the SDK to the Project
To add the Flutter SDK to your project, run the following command:
flutter pub add realm
This downloads the realm package, and adds it to your project.
In your pubspec.yaml
file, you should see:
dependencies: realm: <latest_version>
Note
Using Networking in your macOS App
If you are developing with Flutter in the macOS App Sandbox and require network access, you must enable network entitlements in your app. By default, network requests are not allowed due to built-in macOS security settings.
To learn how to change your app's macOS entitlements, refer to Device Sync and App Sandbox Entitlements.
Update the Package Version
To change the version of the SDK in your project, perform the following steps:
Regenerate Object Models
Changes to the package version may affect the functionality of the object models. From the command line, run the following command to regenerate object models with new and updated functionality:
dart run realm generate
Important
SDK v2.0.0 Breaking Change to Generated Files
SDK version 2.0.0 introduces an update to the
builder, which impacts how files generate. In v2.0.0 and later, all
generated files use the .realm.dart
naming convention instead of .g.dart
.
This is a breaking change for existing apps. For information on how to upgrade an existing app from an earlier SDK version to v2.0.0 or later, refer to Upgrade to Flutter SDK v2.0.0.
Import the SDK
To use the SDK in your app, import the package into any files that use it:
import 'package:realm/realm.dart';
Platform-Specific Considerations
Apple Privacy Manifest
When building for Apple platforms, Apple requires any apps or third-party SDKs that use required reasons APIs to provide a privacy manifest. The manifest contains details about the app's or SDK's data collection and use practices, and it must be included when submitting new apps or app updates to the Apple App Store.
Some of the SDK language and framework libraries provide a privacy manifest to streamline this process. Starting in version 2.2.0, the Dart and Flutter libraries provide a privacy manifest.
For details, refer to The Atlas Device SDK Apple Privacy Manifest.