Skip to content

Commit 7f294fe

Browse files
authored
(DOCSP-39500): Consolidate Install page (#3326)
## Pull Request Info - SDK Docs Consolidation Jira ticket: https://jira.mongodb.org/browse/DOCSP-39500 **Notes for Reviewer** Only five of the pages listed here should be considered to be in a "complete" state as of this PR: - Install - Apple Privacy Manifest - Build for tvOS - Install Atlas Device SDK for Flutter - Upgrade to Flutter SDK v2.0.0 I moved content off of existing install pages onto a bunch of other pages, but those pages will get more updates in the future to make them coherent pages. For now, you only need to confirm that the content got moved successfully and everything is still working. Also, noting here that per conversations with the product and engineering teams, we are intentionally omitting the Java SDK (Java and Java-Kotlin) from the Install page. *Staged Page* - [Install](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/sdk/install/) - Build for Platforms - [Android](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/platforms/android/) - [Apple](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/platforms/apple/) - [Apple Privacy Manifest](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/platforms/apple/privacy-manifest/) - [Build for tvOS](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/platforms/apple/tvos/) - [IoT](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/platforms/iot/) - [Build for Unity](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/platforms/unity/) - Build for Frameworks - [Install Atlas Device SDK for Flutter](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/frameworks/flutter/install/) - [Upgrade to Flutter v 2.0.0](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39500/hidden-pages/upgrade-to-v2/): I intentionally orphaned this one in a new `hidden-pages` directory. I don't think this is necessarily important enough to surface in the ToC, and we don't have a good pattern for doing that in the new consolidated world. It's available in the "Upgrade" section, and we could link to it elsewhere if we come up with a better pattern later. *Page Source* Add links to every SDK's pages where you got the SDK-specific information: - [C++: Install](https://www.mongodb.com/docs/atlas/device-sdks/sdk/cpp/install/) - [.NET: Install](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/install/) - [Flutter: Install](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/install/) - [Flutter: Troubleshooting](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/troubleshooting/#std-label-flutter-macos-development) - [Upgrade to SDK v2.0.0](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/upgrade-to-v2/) - [Kotlin: Install](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/install/) - [Node.js: Install](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/install/) - [Swift: Install](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/install/) - [Swift: Build for tvOS](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/realm-files/tvos/) ### PR Author Checklist Before requesting a review for your PR, please check these items: - [x] Open the PR against the `feature-consolidated-sdk-docs` branch instead of `master` - [x] Tag the consolidated page for: - genre - meta.keywords - meta.description #### Naming - [x] Update Realm naming and the language around persistence layer/local/device per [this document](https://docs.google.com/document/d/126OczVxBWAwZ4P5ZsSM29WI3REvONEr1ald-mAwPtyQ/edit?usp=sharing) - [x] Include `.rst` files comply with [the naming guidelines](https://docs.google.com/document/d/1h8cr66zoEVeXytVfvDxlCSsUS5IZwvUQvfSCEXNMpek/edit#heading=h.ulh8b5f2hu9) #### Links and Refs - [x] Create new consolidated SDK ref targets starting with "_sdks-" for relevant sections - [x] Remove or update any SDK-specific refs to use the new consolidated SDK ref targets - [x] [Update any Kotlin API links](https://jira.mongodb.org/browse/DOCSP-32519) to use the new Kotlin SDK roles #### Content - [x] Shared code boxes have snippets or placeholders for all 9 languages - [x] API description sections have API details or a generic placeholder for all 9 languages - [x] Check related pages for relevant content to include - [x] Create a ticket for missing examples in each relevant SDK: Consolidation Gaps epic ### Reviewer Checklist As a reviewer, please check these items: - [x] Shared code example boxes contain language-specific snippets or placeholders for every language - [x] API reference details contain working API reference links or generic content - [x] Realm naming/language has been updated - [x] All relevant content from individual SDK pages is present on the consolidated page
1 parent fc3abb9 commit 7f294fe

File tree

62 files changed

+2266
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2266
-13
lines changed

snooty.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ intersphinx = [
1111
toc_landing_pages = [
1212
# New IA
1313
"/sdk/crud/create",
14+
"/sdk/platforms/android",
15+
"/sdk/platforms/apple",
16+
"/sdk/platforms/unity",
1417

1518
# Tutorial
1619
"/tutorial",
@@ -86,6 +89,8 @@ atlas = "Atlas"
8689
admin-api-page = "/admin/api/v3/#"
8790
base-url = "https://www.mongodb.com/docs/realm"
8891
cpp-prefix = "https://www.mongodb.com/docs/realm-sdks/cpp/latest"
92+
dart-minimum-version="3.3.0"
93+
flutter-minimum-version="3.19.0"
8994
kotlin-sdk-version = "1.16.0"
9095
kotlinx-coroutines-version = "1.7.0"
9196
kotlin-sync-prefix = "https://www.mongodb.com/docs/realm-sdks/kotlin/latest/library-sync/"

source/frameworks/flutter.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Build with Flutter
77
.. toctree::
88
:titlesonly:
99

10+
Install </frameworks/flutter/install>
1011
Quick Start </frameworks/flutter/quick-start>

source/frameworks/flutter/install.txt

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
.. _sdks-install-sdk-in-flutter-project:
2+
3+
====================================
4+
Install Atlas Device SDK for Flutter
5+
====================================
6+
7+
.. meta::
8+
:description: Install the Atlas Device SDK in a Flutter application.
9+
:keywords: Realm, Flutter SDK, code example
10+
11+
.. facet::
12+
:name: genre
13+
:values: tutorial
14+
15+
.. facet::
16+
:name: programming_language
17+
:values: dart
18+
19+
.. contents:: On this page
20+
:local:
21+
:backlinks: none
22+
:depth: 2
23+
:class: singlecol
24+
25+
Use Atlas Device SDK in a Flutter project to build cross-platform
26+
applications with Flutter and Dart. This guide provides instructions for
27+
installing the SDK in a Flutter project. For details about installing the SDK
28+
in a standalone Dart project, refer to
29+
:ref:`sdks-install`.
30+
31+
Requirements
32+
------------
33+
34+
Install Flutter with Dart in your development environment. The Flutter
35+
installation includes Dart. To learn how, refer to the official
36+
`Flutter Installation Guide <https://docs.flutter.dev/get-started/install>`__.
37+
38+
When building a project with Flutter, the SDK requires the following minimum
39+
versions:
40+
41+
- Flutter version {+flutter-minimum-version+} or later.
42+
- Dart version {+dart-minimum-version+} or later.
43+
44+
Supported Platforms
45+
~~~~~~~~~~~~~~~~~~~
46+
47+
.. include:: /includes/api-details/dart/install/install-supported-platforms-description.rst
48+
49+
Install the SDK
50+
---------------
51+
52+
.. procedure::
53+
54+
.. step:: Create a Project
55+
56+
To create a Flutter project, run the following commands:
57+
58+
.. code-block:: bash
59+
60+
flutter create <app_name>
61+
cd <app_name>
62+
63+
For more information, refer to Flutter's `Get Started Guide
64+
<https://docs.flutter.dev/get-started/test-drive?tab=terminal>`__.
65+
66+
.. step:: Add the SDK to the Project
67+
68+
To add the Flutter SDK to your project, run the following command:
69+
70+
.. code-block:: bash
71+
72+
flutter pub add realm
73+
74+
This downloads the `realm <https://pub.dev/packages/realm>`__
75+
package, and adds it to your project.
76+
77+
In your ``pubspec.yaml`` file, you should see:
78+
79+
.. code-block:: yaml
80+
:caption: pubspec.yaml
81+
82+
dependencies:
83+
realm: <latest_version>
84+
85+
.. note:: Using Networking in your macOS App
86+
87+
If you are developing with Flutter in the macOS App Sandbox and
88+
require network access, you must enable network entitlements in your
89+
app. By default, network requests are not allowed due to built-in
90+
macOS security settings.
91+
92+
To learn how to change your app's macOS entitlements, refer to
93+
:ref:`Device Sync and App Sandbox Entitlements
94+
<sdks-macos-flutter-app-sandbox-entitlements>`.
95+
96+
Update the Package Version
97+
--------------------------
98+
99+
To change the version of the SDK in your project, perform the following steps:
100+
101+
.. procedure::
102+
103+
.. step:: Update the ``pubspec.yaml`` File
104+
105+
Update the package version in your :file:`pubspec.yaml` file dependencies.
106+
107+
.. code-block:: yaml
108+
:caption: pubspec.yaml
109+
110+
dependencies:
111+
realm: <updated_version>
112+
113+
.. step:: Install the Updated Package
114+
115+
From the command line, run the following command to install the updated
116+
version:
117+
118+
.. code-block::
119+
120+
dart pub upgrade realm
121+
122+
Then, run the following command to install the updated SDK's native
123+
binaries:
124+
125+
.. code-block::
126+
127+
dart run realm install
128+
129+
.. step:: Regenerate Object Models
130+
131+
Changes to the package version may affect the functionality of the object
132+
models. From the command line, run the following command to regenerate
133+
object models with new and updated functionality:
134+
135+
.. code-block:: bash
136+
137+
dart run realm generate
138+
139+
.. include:: /includes/flutter-v2-breaking-change.rst
140+
141+
Import the SDK
142+
--------------
143+
144+
To use the SDK in your app, import the package into any files that use it:
145+
146+
.. code-block:: dart
147+
:caption: ExampleFile.dart
148+
149+
import 'package:realm/realm.dart';
150+
151+
Platform-Specific Considerations
152+
--------------------------------
153+
154+
.. include:: /includes/api-details/dart/install/install-platform-specific-considerations-description.rst

source/hidden-pages/upgrade-to-v2.txt

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
:orphan:
2+
3+
.. _flutter-upgrade-v2:
4+
5+
=============================
6+
Upgrade to Flutter SDK v2.0.0
7+
=============================
8+
9+
.. meta::
10+
:description: Upgrade your existing Flutter or Dart app to Flutter SDK version 2.0.0 or later.
11+
:keywords: code example, migration, migrate
12+
13+
.. facet::
14+
:name: genre
15+
:values: tutorial
16+
17+
.. contents:: On this page
18+
:local:
19+
:backlinks: none
20+
:depth: 2
21+
:class: singlecol
22+
23+
Atlas Device SDK for Flutter version 2.0.0 introduces several breaking changes
24+
that impact existing apps upgrading from an earlier version.
25+
26+
Notably, this version of the SDK:
27+
28+
- Changes the part builder and how the SDK generates files for
29+
your data model classes. This change impacts all apps upgrading from an
30+
earlier version of the SDK. Refer to the :ref:`flutter-v2-builder-breaking-changes`
31+
section on this page for information and instructions.
32+
33+
- Removes or replaces several classes and members. These changes may or may not impact your
34+
app. Refer to the :ref:`flutter-v2-removed-classes` section
35+
on this page for information and instructions for impacted apps.
36+
37+
.. _flutter-v2-builder-breaking-changes:
38+
39+
Builder Changes
40+
---------------
41+
42+
.. important::
43+
44+
This change impacts all apps upgrading from an earlier version of the SDK.
45+
46+
Flutter SDK version 2.0.0 updates the SDK's ``realm_generator`` to use a
47+
``PartBuilder`` instead of a ``SharedPartBuilder``.
48+
This updated builder generates ``RealmModel`` data model files with a new
49+
``.realm.dart`` file extension:
50+
51+
.. list-table::
52+
:header-rows: 1
53+
:widths: 25 25 50
54+
55+
* - Version
56+
- File Extension
57+
- Example Part Directive
58+
59+
* - SDK v2.0.0 and later
60+
- ``.realm.dart``
61+
- .. literalinclude:: /examples/generated/flutter/migrate_parts.snippet.part-directive-new.dart
62+
:language: dart
63+
64+
* - SDK v1.9.0 and earlier
65+
- ``.g.dart``
66+
- .. literalinclude:: /examples/generated/flutter/migrate_parts.snippet.part-directive-old.dart
67+
:language: dart
68+
69+
.. tip::
70+
71+
The update from ``SharedPartBuilder`` to ``PartBuilder`` makes it easier
72+
to use multiple builders in your app. For example, combining ``realm_dart``
73+
with a serialization package builder such as ``dart_mappable`` or
74+
``json_serializable``.
75+
76+
.. _flutter-v2-what-do-i-need-to-do:
77+
78+
What Do I Need to Do?
79+
~~~~~~~~~~~~~~~~~~~~~
80+
81+
When you upgrade an existing app from an earlier version of the Flutter SDK to
82+
version 2.0.0 or later, you *must* update any existing part declarations, then
83+
regenerate the object models with the new ``.realm.dart`` file extension:
84+
85+
.. procedure::
86+
87+
.. step:: Update Your Existing Part Declarations
88+
89+
Update all of the ``RealmObject`` part declarations in your app to
90+
use the new naming convention:
91+
92+
.. literalinclude:: /examples/generated/flutter/migrate_parts.snippet.migrate-model-dart-new.dart
93+
:language: dart
94+
:emphasize-lines: 3-5
95+
96+
.. step:: Regenerate Your Object Models
97+
98+
.. tabs::
99+
100+
.. tab:: Flutter
101+
:tabid: flutter
102+
103+
After you update all of your declarations, regenerate your
104+
object models with the new ``.realm.dart`` file extension.
105+
You can safely delete any ``.g.dart`` files from your project.
106+
107+
.. code-block::
108+
109+
dart run realm generate
110+
111+
.. tab:: Dart Standalone
112+
:tabid: dart
113+
114+
After you update all of your declarations, regenerate your
115+
object models with the new ``.realm.dart`` file extension.
116+
You can safely delete any ``.g.dart`` files from your project.
117+
118+
.. code-block::
119+
120+
dart run realm_dart generate
121+
122+
.. _flutter-v2-removed-classes:
123+
124+
Removed Classes and Members
125+
---------------------------
126+
127+
Flutter SDK version 2.0.0 also removed or replaced several classes, members, and properties
128+
from the SDK. These changes may or may not impact your app.
129+
130+
The following table outlines what was removed and why, as well as a recommended solution
131+
when upgrading an app that used the removed class or member, if any:
132+
133+
.. list-table::
134+
:header-rows: 1
135+
:widths: 33 33 33
136+
137+
* - Removed Class or Member
138+
- Reason
139+
- Solution
140+
141+
* - ``AppConfiguration.localAppName`` and ``AppConfiguration.localAppVersion``
142+
- Unused in SDK.
143+
- Remove any instances.
144+
145+
* - ``ClientResetError.isFatal``
146+
- Not needed. Always ``true``.
147+
- Remove any instances.
148+
149+
* - ``ClientResetError.sessionErrorCode``
150+
- Consolidated into ``SyncErrorCode`` in SDK v1.6.0.
151+
- Use ``SyncErrorCode`` enum. See also the
152+
:flutter-sdk:`SyncError <realm/SyncErrorCode.html>` API reference.
153+
154+
* - ``Realm.logger.level``
155+
- Replaced by ``Realm.logger.setLogLevel``.
156+
- Replace any instances. See also :ref:`sdks-logging`.
157+
158+
* - ``RealmProperty.indexed``
159+
- Replaced by ``RealmProperty.indexType``.
160+
- Replace any instances.
161+
162+
* - ``RealmValue.type``
163+
- Changed to an enum of ``RealmValueType``.
164+
- Replace any instances. See also :ref:`RealmValue Data Type <sdks-mixed-data-type>`.
165+
166+
* - ``RealmValue.uint8List``
167+
- Renamed to ``RealmValue.binary``.
168+
- Replace any instances. See also :ref:`RealmValue Data Type <sdks-mixed-data-type>`.
169+
170+
* - ``SchemaObject.properties``
171+
- ``SchemaObject`` changed to an iterable collection of ``SchemaProperty``.
172+
- Replace any instances. See also the
173+
:flutter-sdk:`SchemaObject <realm/SchemaObject-class.html>` API reference.
174+
175+
* - ``SyncError`` constructor and ``SyncError.create`` factory
176+
- Sync errors should only be created internally by the SDK.
177+
- Remove any instances.
178+
179+
* - ``SyncClientError``, ``SyncConnectionError``, ``SyncSessionError``,
180+
``SyncResolveError``, ``SyncWebSocketError``, and ``GeneralSyncError``
181+
- Consolidated into ``SyncError`` in SDK v1.6.0.
182+
- Use ``SyncError`` or its subclasses. See also the
183+
:flutter-sdk:`SyncError <realm/SyncErrorCode.html>` API reference.
184+
185+
* - ``SyncErrorCategory``, ``SyncClientErrorCode``, ``SyncConnectionErrorCode``,
186+
``SyncSessionErrorCode``, ``SyncResolveErrorCode``,``SyncWebsocketErrorCode``,
187+
and ``GeneralSyncErrorCode``
188+
- Consolidated into ``SyncErrorCode`` in SDK v1.6.0.
189+
- Use ``SyncErrorCode`` enum. See also the
190+
:flutter-sdk:`SyncError <realm/SyncErrorCode.html>` API reference.
191+
192+
* - ``SyncError.codeValue``, ``SyncError.category``, and ``SyncError.detailedMessage``
193+
- Consolidated into ``SyncError`` in SDK v1.6.0. Messages were unused.
194+
- Remove any category or message instances. Replace ``SyncError.codeValue``
195+
with ``SyncError.code.code``. See also the
196+
:flutter-sdk:`SyncError <realm/SyncErrorCode.html>` API reference.
197+
198+
* - ``SyncProgress.transferredBytes`` and ``SyncProgress.transferableBytes``
199+
- Reported transferred and transferable values were incorrect. Consolidated
200+
into a new ``SyncProgress.progressEstimate`` metric.
201+
- Use ``SyncProgress.progressEstimate``. See also :ref:`sdks-check-upload-and-download-progress`.
202+
203+
* - ``User.provider``
204+
- Provider is associated with each identity, so value was incorrect
205+
for users with more than one identity.
206+
- Remove any instances.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Make the SDK available in your code by including the
2+
``cpprealm/sdk.hpp`` header in the translation unit where you want to use it.

0 commit comments

Comments
 (0)