Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved logging to (maybe) get more hints about this problem #396

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/utils/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Device Parameters $deviceInfo""";
error(
'Uncaught Error: ${isolateError.first.toString()}',
error: isolateError.first.toString(),
stackTrace: isolateError.last.toString(),
stackTrace: isolateError.length >= 2 && isolateError[1] != null && isolateError[1].toString() != '' ? isolateError[1] : StackTrace.current,
);
}).sendPort,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Result? _decodeQRCode(BinaryBitmap bitmap) {
/// Args: [SendPort] sendPort, [CameraImage] cameraImage, [int] rotation, [double] borderPaddingPercent
void _scanQrCodeIsolate(List args) {
final SendPort sendPort = args[0] as SendPort;
final CameraImage cameraImage = args[1] as CameraImage;
final int rotation = args[2] as int;
final double borderPaddingPercent = args[3] as double;

try {
final CameraImage cameraImage = args[1] as CameraImage;
final int rotation = args[2] as int;
final double borderPaddingPercent = args[3] as double;

final imgSize = min(cameraImage.width, cameraImage.height);
final cropPadding = (imgSize * borderPaddingPercent / 100).round();
final cropHorizontal = (cameraImage.width - imgSize + cropPadding) ~/ 2;
Expand All @@ -50,14 +50,9 @@ void _scanQrCodeIsolate(List args) {
);
var bitmap = BinaryBitmap(GlobalHistogramBinarizer(source));
Result? result = _decodeQRCode(bitmap);
if (result == null) {
sendPort.send(null);
return;
}
sendPort.send(result);
return;
} catch (e) {
Logger.error('Error while scanning QR code: $e, name: _QRScannerWidgetState#_scanQrCode');
sendPort.send(e);
return;
}
Expand Down
Loading