onData method

void onData(
  1. IsolatePayload data
)

Handles data coming from the child isolates.

Implementation

void onData(IsolatePayload data) {
  switch (data) {
    case FramePayload(:final image, :final details):
      collection.videoServer.sendMessage(VideoData(frame: image, details: details));
    case DepthFramePayload():
      collection.videoServer.sendMessage(VideoData(frame: data.frame.depthFrame), destination: autonomySocket);
      data.dispose();
    case LogPayload(): switch (data.level) {
      // Turns out using deprecated members when you *have* to still results in a lint.
      // See https://github.com/dart-lang/linter/issues/4852 for why we ignore it.
      case LogLevel.all: logger.info(data.message);
      // ignore: deprecated_member_use
      case LogLevel.verbose: logger.trace(data.message);
      case LogLevel.trace: logger.trace(data.message);
      case LogLevel.debug: logger.debug(data.message);
      case LogLevel.info: logger.info(data.message);
      case LogLevel.warning: logger.warning(data.message);
      case LogLevel.error: logger.error(data.message);
      // ignore: deprecated_member_use
      case LogLevel.wtf: logger.info(data.message);
      case LogLevel.fatal: logger.critical(data.message);
      // ignore: deprecated_member_use
      case LogLevel.nothing: logger.info(data.message);
      case LogLevel.off: logger.info(data.message);
    }
  }
}