make sure you have Flutter 2.8 and Dart 2.15 flutter --version Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision 77d935af4d (5 weeks ago) • 2021-12-16 08:37:33 -0800 Engine • revision 890a5fca2e Tools • Dart 2.15.1
Run these commands to setup the application:
-
Disable Realm analytics. Set env variable
REALM_DISABLE_ANALYTICS=exists
either globally (for example, in.zshrc
) or locally to this terminal only. I suggest globally not to forget about it and upload analytics unnecessarily. -
Get all packages for the example project:
dart pub get
-
Install Realm Dart SDK:
dart run realm_dart install
-
Run the generator to generate the required Realm object definitions. (If asked "Found 4 declared outputs which already exist on disk.Delete these files?" use option 1. Delete):
dart run realm_dart generate
-
Run the project's tests without concurrency:
dart run test --concurrency=1
Or run the test script:
./scripts/test.sh
Note: If you do not use
--concurrency=1
, you will get a bunch of strange errors.
For API usage, refer to the tests in the realm-dart repo: https://github.com/realm/realm-dart/blob/main/test/realm_test.dart
Sometimes you may need to use an unpublished version of the realm_dart
package
for testing features before a release. To do this, you must pull the unpublished version of the
realm_dart package locally, download the realm binary, and add it to the
realm-docs (this) project.
Note: All the files you add here won't be committed to git as they're already
in the .gitignore
file in the examples/dart
directory.
Note: In the future, the Realm Dart SDK team plans for pre-release versions to be published to pub.dev.
Get the latest version of the realm-dart project, and add it with this directory,
examples/dart
.
git clone https://github.com/realm/realm-dart.git
Now you must download the realm binary that accompanies the release for your OS.
- Go to the realm-dart Github repo Realm Dart CI Github action.
- Click the latest passing workflow run.
- Scroll down to the bottom of the Workflow to the Artifacts section.
- Download the artifact for your OS (ex.
librealm-macos
). - Unzip the binary. It has a name like
librealm_dart.dylib
. - Add this binary file to the following location within the
docs-realm
repo:examples/dart/binary/<your OS>/librealm_dart.dylib
. The names for the OS folders aremacos
,linux
,windows
.
If you're using MacOS, the operating system may give you a security warning when you try to run the file. You can address this by following these steps.
Update your pubspec.yaml
to point to your local version of realm-dart.
dependencies:
realm_dart:
path: ./realm-dart
In the future if you're changing the project to use the version of realm_dart published to pub.dev, change this back to:
dependencies:
realm_dart: <my version number>