-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
_send is somehow destroying additional field in Computer #4
Comments
@Ben1980 I think its an issue on how Isolates transfer objects. You either have to make the If this doesn't work I suggest caching the object on the isolate site and only passing an identifier, and retrieving from cached objects when the identifier is passed back. Isolates in Dart can transfer objects between them, but with some limitations:
There are a few more limitations, read here. |
You're right, i think as well this is the issue. BluetoothDevice is a foreign class from flutter_blue_plus unfortunately so I will need to got the caching way. Do you have any hint or suggestion how to do it? Otherwise I would utilize shared_preferences. |
@Ben1980 first you should try making the field I wouldn't go with shared preferences or any persistent caches, but instead a normal memory cache. |
How would you do that for a foreign class of another plugin like BluetoothDevice? As far as I can see it is not providing a proper |
@Ben1980 I think it does implement the required equality functions! So what you can do now is the following: final bluetoothDeviceCache = Map<int, BluetoothDevice>();
/// Function returns a hashCode which can be used to retrieve the BluetoothDevice
int storeBluetoothDevice(BluetoothDevice device) {
bluetoothDeviceCache[device.hashCode] = device;
return device.hashCode;
}
/// Function returns a BluetoothDevice based on its hashCode.
BluetoothDevice? getBluetoothDevice(int hashCode) {
return bluetoothDeviceCache[hashCode];
} now just pass the |
Ok currently i don't know how to solve thisproblem. I tried passing |
I'm currently working on BLE support. Because of that, I needed to extend
Computer
with the additional fieldBluetoothDevice? device
. The problem starts when calling download viadownload
, afterward the object computer no longer contains a validBluetoothDevice
object. All other fields are fine.The text was updated successfully, but these errors were encountered: