init function

void init(
  1. InitRequest initReq
)

Implementation

void init(InitRequest initReq) {
  // Create ArucoDetector
  _detector = _ArucoDetector();

  // Save the port on which we will send messages to the main thread
  _toMainThread = initReq.toMainThread;

  // Create a port on which the main thread can send us messages and listen to it
  ReceivePort fromMainThread = ReceivePort();
  fromMainThread.listen(_handleMessage);

  // Send the main thread the port on which it can send us messages
  _toMainThread.send(fromMainThread.sendPort);
}