You can use the Atlas Device SDK for Flutter in a Flutter project or in a standalone Dart project. This guide provides instructions for installing the SDK in both types of projects.
Requisitos previos
To get started with the Atlas Device SDK for Flutter, you need to install the following, depending on the type of app you are developing:
For Flutter or Dart apps, install Flutter with Dart in your development environment. The Flutter installation includes Dart. To learn how, refer to the official Guía de instalación de Flutter.
For standalone Dart apps, you can install Dart in your development environment without Flutter. To learn how, refer to the official Dart Installation Guide.
La versión más reciente del SDK de Flutter requiere las siguientes versiones mínimas:
Flutter version 3.19.0 or later.
Versión Dart 3.3.0 o posterior.
Plataformas compatibles
El SDK de Flutter es compatible con las siguientes plataformas:
iOS
Android
macOS
Windows ejecutándose en una arquitectura de 64bits
Linux running on 64-bit architecture
Importante
Plataformas no compatibles
El SDK de Flutter no admite las siguientes plataformas:
Web
Windows ejecutándose en arquitecturas ARM64 o de 32bits
Linux running on ARM64 or 32-bit architectures
Instalar el SDK
El Atlas Device SDK para Flutter tiene dos paquetes disponibles para instalar, dependiendo de si está desarrollando una aplicación independiente de Flutter o Dart:
realm: El paquete Flutter SDK para uso en aplicaciones Flutter.realm_dart:El paquete SDK de Dart independiente para usar en aplicaciones Dart, como aplicaciones CLI o ejecutar Dart en un entorno de servidor.
El paquete Dart independiente tiene el mismo uso que el paquete Flutter excepto que se indique lo contrario.
Tip
Atlas Device SDK and Realm
El SDK de Flutter utiliza la base de datos Realm Core para la persistencia de los datos del dispositivo. Al instalar el SDK de Flutter, los nombres de los paquetes reflejan la nomenclatura de Realm.
Crear un proyecto
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.
Para crear un proyecto en Dart, ejecuta los siguientes comandos:
dart create <app_name> cd <app_name>
For more information, refer to Dart's Get Started Guide for standalone Dart command-line and server applications.
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.
En tu archivo pubspec.yaml deberías ver:
dependencies: realm: <latest_version>
Nota
Using Networking in your macOS App
If you are developing with the Flutter SDK 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 use networking in your macOS app, you must change your app's macOS network entitlements. To learn how, refer to Use Realm with the macOS App Sandbox.
To add the SDK to your project, run the following command:
dart pub add realm_dart
This downloads the realm_dart package, and adds it to your project.
En tu archivo pubspec.yaml deberías ver:
dependencies: realm_dart: <latest_version>
Después de agregar el paquete, ejecute el siguiente comando para instalarlo:
dart run realm_dart install
This downloads and copies the required native binaries to the app directory.
Actualizar la versión del paquete
To change the version of the SDK in your project, perform the following steps, depending on whether you are using the realm or realm_dart package:
Instalar el paquete actualizado
Run the following command to install the updated version:
dependencies: realm: <updated_version>
Run the following command to install the updated version:
dart pub upgrade realm_dart
Then, run the following command to install the updated SDK's native binaries:
dart run realm_dart install
Regenerar modelos de objetos
dart run realm generate
dart run realm_dart generate
Importante
Flutter SDK v2.0.0 Breaking Change to Generated Files
Flutter 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.
Solución de problemas
If you have issues using the updated SDK version in your application, you can delete the .realm database file created by the SDK, and restart the application. Note that deleting the .realm file also deletes all data stored in the database on that client.
Para obtener más información, consulte Eliminar un archivo de reino - Flutter SDK.
Apple Privacy Manifest
Nuevo en la versión 2.2.0.
Apple requiere que cualquier aplicación o SDK de terceros que utilice las API de motivos obligatorios proporcione un manifiesto de privacidad. El manifiesto contiene detalles sobre las prácticas de colección y uso de datos de la aplicación o el SDK y debe incluirse al enviar nuevas aplicaciones o actualizaciones de aplicaciones a la Apple App Store. Para obtener más detalles sobre estos requisitos, consulta Próximos requisitos de SDK de terceros en el sitio web de Apple Developer.
A partir de la versión 2.2.0 del SDK de Flutter, este se entrega con un manifiesto de privacidad para los entornos iOS y macOS, incluido en el paquete realm. Ambos manifiestos de privacidad contienen las divulgaciones de API requeridas por Apple y las razones para usarlas.
You can view these privacy manifests in the SDK package or directly in the realm-dart GitHub repository:
iOS: https://github.com/realm/realm-dart/blob/main/packages/realm/ios/Resources/PrivacyInfo.xcprivacymacOS: https://github.com/realm/realm-dart/blob/main/packages/realm/macos/Resources/PrivacyInfo.xcprivacy
The Flutter SDK does not:
Incluye el código de análisis en compilaciones para la App Store.
Log into Atlas on its own behalf.
Importante
Es posible que se requieran divulgaciones adicionales para los servicios de aplicaciones
El manifiesto de privacidad del SDK de Flutter no incluye divulgaciones para las API de Servicios de aplicación.
Si su aplicación utiliza alguna funcionalidad de Atlas App Services, como la autenticación de usuarios o la sincronización de dispositivos, es posible que deba proporcionar información adicional que detalle sus prácticas de recopilación y uso de datos al usar estas API. Por ejemplo, si su aplicación inicializa un cliente de aplicación para:
For more information, refer to Apple's Privacy Manifest Files documentation.