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

Make returning Code nullable #5

Closed
leoshusar opened this issue Jul 7, 2021 · 0 comments · Fixed by #6
Closed

Make returning Code nullable #5

leoshusar opened this issue Jul 7, 2021 · 0 comments · Fixed by #6

Comments

@leoshusar
Copy link
Contributor

Since jsQR returns null if no code has been decoded, this library should return nullable Code.

If you write this:

Code? code = jsQR(imgData.data, canvas.width, canvas.height);
if (code != null) {
  print(code.data);
}

dart2js in release mode optimizes out the null check, because jsQR returns non nullable object and then it tries to print(code.data); even though code is null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant