setup method

Future<void> setup()

Implementation

Future<void> setup() async {
  if (onImageListener == null) {
    printLog("...AnalysisController off, no onImageListener");
    return;
  }
  if (imageSubscription != null) {
    printLog('AnalysisController controller already started');
    return;
  }

  if (Platform.isIOS) {
    await CamerawesomePlugin.setupAnalysis(
      format: conf.cupertinoOptions.outputFormat,
      // TODO Can't set width on iOS
      width: 0,
      maxFramesPerSecond: conf.maxFramesPerSecond,
      autoStart: conf.autoStart,
    );
  } else {
    await CamerawesomePlugin.setupAnalysis(
      format: conf.androidOptions.outputFormat,
      width: conf.androidOptions.width,
      maxFramesPerSecond: conf.maxFramesPerSecond,
      autoStart: conf.autoStart,
    );
  }

  if (conf.autoStart) {
    await start();
  }
  printLog("...AnalysisController setup");
}