start method
Implementation
Future<PreviewDetails>? start({
required int width,
required int height,
required QRCodeHandler qrCodeHandler,
List<Symbology>? formats = const [Symbology.QR],
bool camera2Enabled = false,
}) async {
_channelReader.setQrCodeHandler(qrCodeHandler);
var details =
await _channel.invokeMethod(MethodConst.nativeStartCapturing, {
Param.targetWidth: width,
Param.targetHeight: height,
Param.heartbeatTimeout: 0,
Param.formats: formats?.map((e) => e.stringify).toList(),
Param.camera2Enabled: camera2Enabled,
});
int? textureId = details[Param.textureId];
num? orientation = details[Param.surfaceOrientation];
num? surfaceHeight = details[Param.surfaceHeight];
num? surfaceWidth = details[Param.surfaceWidth];
return PreviewDetails(
surfaceWidth,
surfaceHeight,
orientation,
textureId,
);
}