doWorkLog static method

void doWorkLog(
  1. SendPort port1
)

Implementation

static void doWorkLog(SendPort port1) {
  ReceivePort logReceivePost = ReceivePort();
  SendPort port2 = logReceivePost.sendPort;
  logReceivePost.listen((message) {
    File file = message[0] as File;
    String text = message[1] as String;
    bool append = message[2] as bool;
    LogFileUtil.listenLog(file, text, append);
  });
  // 将新isolate中创建的SendPort发送到main isolate中用于通信
  // print("port1--new isolate发送消息");
  port1.send([0, port2]);
}