-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Better support for Hot Reload #773
Comments
This does not reproduce on Android/iOS with hot reload/hot restart on version 3.5.1 for the example app. |
I use the latest versions of flutter and mobile_scanner, and this issue still occurs when hot reloading, which I will try to repeat later |
@laterdayi Does this reproduce on version 5.0.0-beta.1 ? We fixed the lifecycle management issues in that release, so I think that solves this bug. |
Hi @navaronbracke I'm on version 5.0.0-beta.1 and I'm running into this error |
Okay, then I think I know what is happening. The package will have to listen to hot reload events to prevent this issue from happening. We might be able to leverage https://api.flutter.dev/flutter/widgets/State/reassemble.html |
(maybe this topic can help once fixed : flutter/flutter#10437) |
i get this issue with hot restart, not hot reload |
@lukepighetti I published a patch on the master branch #1086 that hopefully fixes this issue. I plan on publishing this fix today. If you feel like verifying it on your end (using a git override), feel free to do so. |
I confirm that the issue occurs after a hot restart (not a hot reload). If I perform a hot restart with the camera already open, the screen turns black when I open camera again, but the scanning functionality continues to work. I have to restart build to fix the problem. I’m using I’m also using the controller approach as indicated in this example: Barcode Scanner Controller Example.
EDIT add logs:
EDIT 2 : issue still there with |
Do you have any logs of when that occurred? Do you hit the |
same, this problem is still there |
Interesting. So the error comes back as a with the same error code. Since the catch clause only runs on the former, but not the latter, it turns into an unhandled error. But then I wonder why the catch on https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/method_channel/mobile_scanner_method_channel.dart#L232-L237 did not catch this. That one does handle PlatformExceptions |
Using Hot Reload on either iOS or Android on view with camera causes MobileScanner: Called start() while already started! error.
Repro steps:
build example app to device
open any camera screen
do Hot Reload
This problem still exists in the latest version
The text was updated successfully, but these errors were encountered: