But the problem is an isolate ReceivePort can't send a complex object like a TdObject. So I have to serialize the data to JSON with .toJSON(). But when it reaches the listenevent back up in startTelegram (on the main thread), it's a string that I cannot turn back into a TdObject.
As far as I can tell, there is no .fromJson() option available in this library. Am I mistaken?
Am I prematurely optimizing by putting this listener in an isolate? Is it not necessary? Any other tips or suggestions?
I really appreciated the simplicity and clarity of your event listener example in the Readme:
Is it a good idea to put that event listener on a background isolate? I've managed to do that like this:
But the problem is an isolate
ReceivePort
can'tsend
a complex object like aTdObject
. So I have to serialize the data to JSON with.toJSON()
. But when it reaches thelisten
event back up instartTelegram
(on themain
thread), it's a string that I cannot turn back into aTdObject
.As far as I can tell, there is no
.fromJson()
option available in this library. Am I mistaken?Am I prematurely optimizing by putting this listener in an isolate? Is it not necessary? Any other tips or suggestions?
Thank you! 😊