jhoogstraat / fast_barcode_scanner

A flutter plugin that allows your users to scan any type of barcode on iOS and Android
41 stars 53 forks source link

Hot Restart generate exception #41

Open guilhermedaldim opened 2 years ago

guilhermedaldim commented 2 years ago

Another problem I noticed, is that in debug when calling Hot Reload with the camera open, I wait for the event end and when trying to open the camera again I get the following: PlatformException (PlatformException(ALREADY_INITIALIZED, Camera is already initialized, null, null)).

I believe it is the dispose() call that is not being made in this case, because when to close and open the camera again, it works normally.

jhoogstraat commented 2 years ago

Can you please add which branch or version you are on?

guilhermedaldim commented 2 years ago

I'm test in develop branch

jhoogstraat commented 2 years ago

Normally the preview should just continue, independent of hot reloads. Maybe if the widget tree is rebuilt...

guilhermedaldim commented 2 years ago

Sorry man the problem occours with Hot Restart

jhoogstraat commented 2 years ago

This seems to be a more general issue with hot restart (related issue)

darkfrog26 commented 2 years ago

I've experienced this as well but never had this problem on the flutter_barcode_scanner, so I would think it's something that can be fixed.

AKortak commented 2 years ago

Any news on this? It's stil happening on develop

CordMemescape commented 2 years ago

I can confirm that this is still an issue using ^2.0.0-dev.2.

If you happen to have the camera active - scanning for a barcode - an exception is thrown when your app is restarted via the debugger and you return to the view with the BarcodeCamera() widget. The following is displayed:

Error: PlatformException(ALREADY_INITIALIZED, Camera is already initialised, null, null)

If you navigate away from the view and back again, the camera reinitialises correctly and you can continue scanning.

renehw commented 2 years ago

Same problem here.