objectbox / objectbox-dart

Flutter database for super-fast Dart object persistence
https://docs.objectbox.io/getting-started
Apache License 2.0
927 stars 115 forks source link

Dart 3.1.0 (Flutter 3.13.0): process terminated due to native objectbox exception #556

Closed greenrobot-team closed 7 months ago

greenrobot-team commented 8 months ago

TL;DR: at this point do not upgrade to Flutter 3.13.0 and Dart 3.1.0 when your app should run on Linux.

If functions are called that throw an exception in the native ObjectBox code, instead of receiving a Dart exception that can be handled the VM process terminates.

Some examples:

// Throws NumericOverflowException
query.property(tLong).sum();

// Shows up in log output like:
terminate called after throwing an instance of 'objectbox::NumericOverflowException'
terminate called recursively

// Throws ObjectBoxException
box.put(User(id: idDoesNotExist), mode: PutMode.update)

// Shows up in log output like:
terminate called after throwing an instance of 'objectbox::IllegalArgumentException'
terminate called recursively

There is a known Dart issue (https://github.com/dart-lang/sdk/issues/53267) about this. A fix is in the works, no ETA.

It appears there are no workarounds other than not updating to Dart 3.1 (shipped with Flutter 3.13) when building for Linux.

greenrobot-team commented 7 months ago

This should be fixed as of Flutter 3.13.6 (shipping with Dart 3.1.3).

greenrobot-team commented 7 months ago

Confirmed fixed as of Flutter 3.13.6 (Dart 3.1.3). If you are affected, make sure to flutter upgrade.