start static method

Future<Detector> start()

Open the database at path and launch the server on a background isolate..

Implementation

static Future<Detector> start() async {
  final ReceivePort receivePort = ReceivePort();
  // sendPort - To be used by service Isolate to send message to our ReceiverPort
  final Isolate isolate = await Isolate.spawn(_DetectorServer._run, receivePort.sendPort);

  final Detector result = Detector._(
    isolate,
    await _loadModel(),
    await _loadLabels(),
  );
  receivePort.listen((message) {
    result._handleCommand(message as _Command);
  });
  return result;
}