-
Notifications
You must be signed in to change notification settings - Fork 68
Either hide or heavily discourage the use of reference
and fromRef
#979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello, @HosseinYousefi
Is it possible for us to send a JObject to another isolate? |
I have explained one way to send them here: #970 (comment) |
@HosseinYousefi |
With the newly released 0.8.0, you can skip the manual way (in Dart's main branch – not yet in stable) and just pass |
@HosseinYousefi , I have updated to 0.8.0, when I pass the JObject to an isolate, the error throws, I use the flutter stable channel now. E/flutter (13009): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Illegal argument in isolate message: (object is a Pointer)
E/flutter (13009): <- Instance of 'JGlobalReference' (from package:jni/src/jreference.dart)
E/flutter (13009): <- $type in Instance of 'BarcodeScanner' (from package:hybrid_vision_android/src/jni.g.dart)
E/flutter (13009): <- scanner in Instance of '_DetectCommand' (from package:hybrid_vision_android/src/barcode_detection.dart)
E/flutter (13009):
E/flutter (13009): #0 _SendPort._sendInternal (dart:isolate-patch/isolate_patch.dart:250:43)
E/flutter (13009): #1 _SendPort.send (dart:isolate-patch/isolate_patch.dart:231:5)
E/flutter (13009): #2 AndroidBarcodeDetector.detect (package:hybrid_vision_android/src/barcode_detection.dart:51:14)
E/flutter (13009): <asynchronous suspension>
E/flutter (13009): #3 _BarcodeDetectionViewState.buildDetectView.<anonymous closure>.<anonymous closure> (package:hybrid_vision_android_example/views/barcode_detection_view.dart:173:38)
E/flutter (13009): <asynchronous suspension>
E/flutter (13009): |
As I said, it's not available on stable channel yet. Use the main channel. |
Is there a exact Dart version that I can do this on stable channel? |
@dcharkes In which version will |
Support landed in Dart in:
|
Thanks, I'll wait for this feature, Can I use the |
Yes, you can. |
Not currently planned as we still need |
Although safe methods like
castTo
are provided, users might still usefromRef
and.reference
to manually cast objects (see #970), keep references without properly managing their lifecycle, etc. Therefore, JniGen generated code should heavily discourage the use of these inner workings and eventually hide them. Right now, we need references to send these finalizableJObject
s between multiple isolates, but dart-lang/sdk#55062 will make these objects sendable.cc/ @dcharkes
The text was updated successfully, but these errors were encountered: