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

Access scanned preview #69

Open
delizondo opened this issue Feb 24, 2022 · 2 comments
Open

Access scanned preview #69

delizondo opened this issue Feb 24, 2022 · 2 comments

Comments

@delizondo
Copy link

First of all, thanks for this amazing scanner, it works really fast.

However, after a barcode is scanned, I need to access the preview image, to pass it as a background for another screen/page.

I tried copying the _buildPreview method into my project, and use it with the CameraController as follows

var background = _buildPreview(
                        CameraController.instance.state.previewConfig!);

However, when compiling the project, I get the following error

Error: Member not found: 'instance'.
lib/…/scanner/scanner_widget.dart:112
                            CameraController.instance.state.previewConfig!);

Any help will be greatly appreciated

@delizondo
Copy link
Author

Update. This happens in version 2.0.0-dev.2, did a downgrade to 1.1.4 and now I can get access to CameraController.instance

@jhoogstraat
Copy link
Owner

jhoogstraat commented Mar 19, 2022

Hey, sorry for leaving you so long.
You are right, v2 does not use CameraController.instance anymore. Instead you can just call CameraController() to get an instance of the controller. Behind the scenes it behaves just like a singleton.

Is your issue solved or do you have suggestion for new features in v2?

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

No branches or pull requests

2 participants