ScanKit constructor

ScanKit({
  1. bool? errorCheck,
  2. bool? photoMode,
  3. int? viewType,
})

Implementation

ScanKit({bool? errorCheck, bool? photoMode, int? viewType})
    : _api = ScanKitApi() {
  if (errorCheck != null) {
    options['errorCheck'] = errorCheck;
  }
  if (photoMode != null) {
    options['photoMode'] = photoMode;
  }
  if (viewType != null) {
    options['viewType'] = viewType;
  }

  _api.createDefaultMode().then((val) {
    _resultChannel = EventChannel('xyz.bczl.scankit/result/$val');
    _subscription = _resultChannel!
        .receiveBroadcastStream()
        .map<ScanResult>((event){
          return event == null ? ScanResult.empty() : ScanResult.from(event);
    })
        .listen((event) {
      _resultSc.add(event);
    }, cancelOnError: false);
    _defaultModeId.complete(val);
  });
}