spawnIsolateInspectorServer function

void spawnIsolateInspectorServer(
  1. ChromeDevToolsService devTool,
  2. KrakenController controller, {
  3. int port = INSPECTOR_DEFAULT_PORT,
  4. String? address,
})

Implementation

void spawnIsolateInspectorServer(ChromeDevToolsService devTool, KrakenController controller, { int port = INSPECTOR_DEFAULT_PORT, String? address }) {
  ReceivePort serverIsolateReceivePort = ReceivePort();

  serverIsolateReceivePort.listen((data) {
    if (data is SendPort) {
      devTool._isolateServerPort = data;
      String bundleURL = controller.url;
      if (bundleURL.isEmpty) {
        bundleURL = '<EmbedBundle>';
      }
      devTool._isolateServerPort!.send(InspectorServerInit(controller.view.contextId, port, '0.0.0.0', bundleURL));
    } else if (data is InspectorFrontEndMessage) {
      devTool.uiInspector!.messageRouter(data.id, data.module, data.method, data.params);
    } else if (data is InspectorServerStart) {
      devTool.uiInspector!.onServerStart(port);
    } else if (data is InspectorPostTaskMessage) {
      if (devTool.isReloading) return;
      dispatchUITask(controller.view.contextId, Pointer.fromAddress(data.context), Pointer.fromAddress(data.callback));
    }
  });

  Isolate.spawn(serverIsolateEntryPoint, serverIsolateReceivePort.sendPort).then((Isolate isolate) {
    devTool._isolateServerIsolate = isolate;
  });
}