ensureInitialized method

Future<void> ensureInitialized()

Implementation

Future<void> ensureInitialized() async {
  if (is_init_isolate) {
    return;
  }
  is_init_isolate = true;
  TdlibIsolateData tdlibIsolateData = TdlibIsolateData(
    sendPort: receivePort.sendPort,
    pathTdlib: path_tdlib,
    delayUpdate: delay_update,
    timeOutUpdate: timeOutUpdate,
  );
  try {
    isolate = await Isolate.spawn<TdlibIsolateData>(
      tdlibIsolate,
      tdlibIsolateData,
      onExit: receivePort.sendPort,
      onError: receivePort.sendPort,
    );
  } catch (e) {
    is_init_isolate = false;
  }
}