Flutter with Realm

I’ve been looking at the examples for Realm and Flutter and I’ve come across an error that I don’t know how to work around.
Realm Flutter documentation
github: realm-dart-samples

I’ve bumped up my Flutter SDK to

flutter --version
Flutter 3.1.0-0.0.pre.1533 • channel master • https://github.com/flutter/flutter.git
Framework • revision 78e3b93664 (18 hours ago) • 2022-07-07 08:34:06 -0400
Engine • revision 56faff459e
Tools • Dart 2.18.0 (build 2.18.0-261.0.dev) • DevTools 2.15.0

The error is when I try to run the apps from the repository:

flutter  run
Multiple devices found:
macOS (desktop) • macos  • darwin-x64     • macOS 12.4 21F79 darwin-x64
Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.114
[1]: macOS (macos)
[2]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 1
Launching lib/main.dart on macOS in debug mode...

Building macOS application...                                           
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RealmException: non-zero custom status code considered fatal

Syncing files to device macOS...                                   635ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on macOS is available at: http://127.0.0.1:60209/IoDFABWbRVg=/
The Flutter DevTools debugger and profiler on macOS is available at: http://127.0.0.1:9100?uri=http://127.0.0.1:60209/IoDFABWbRVg=/

Hi,
This error shows that realm native binary was correctly loaded into the app and most probably it happens cause there are no network entitlements on the app. You can read how to add them here Networking | Flutter
and Building macOS apps with Flutter | Flutter

You can also try running this Flutter sample which does not have network requirements realm-dart-samples/provider_shopper at main · realm/realm-dart-samples · GitHub

Also bumping the Flutter version to Flutter Beta is not required. Consider using the stable version of Flutter.

cheers

1 Like

@Ilan_Toren We have fixed our sample with the correct entitlements. Can you get the latest master and try running it again.

Cheers.

1 Like

So far it looks good. And I have the dart_flexible_sync working. Thanks for your response, because now I can put together the Flutter UI app I want to get off the ground.