tdlibIsolate function
add this for multithread new client on flutter apps
Implementation
Future<void> tdlibIsolate(TdlibIsolateData tdlibIsolateData) async {
TdlibNative.opentdLib(
pathTdlib: tdlibIsolateData.pathTdlib,
);
try {
while (true) {
await Future.delayed(Duration(microseconds: 1));
final Map? new_update = TdlibNative.td_receive_static(
timeout: tdlibIsolateData.timeOutUpdate,
);
if (new_update != null) {
if (new_update["@client_id"] is num == false ||
new_update["@client_id"] is int == false) {
continue;
}
tdlibIsolateData.sendPort.send(
TdlibIsolateReceiveData(
updateData: new_update,
clientId: new_update["@client_id"],
),
);
}
}
} catch (e) {
tdlibIsolateData.sendPort.send(
TdlibIsolateReceiveDataError(),
);
}
}