loadObjectBoxLibraryAndroidCompat function
If your Flutter app runs on Android 6 (or older) devices, call this before using any ObjectBox APIs, to fix loading the native ObjectBox library.
If the device is running Android 6 (or older) this will try to load the native library using Java APIs. Afterwards, calling ObjectBox APIs should load the library successfully on the Dart/Flutter side.
See the GitHub issue for details.
Implementation
Future<void> loadObjectBoxLibraryAndroidCompat() async {
if (!Platform.isAndroid) {
// To support calling this in multi-platform Flutter apps
// do nothing if not Android (plugins for other platforms do not
// implement method below).
return;
}
await _platform.invokeMethod<String>('loadObjectBoxLibrary');
}