Julian Steenbakker

imp: add link for hot-restart issue, add macos check for textureId

... ... @@ -262,12 +262,13 @@ class _MobileScannerState extends State<MobileScanner>
// If debug mode is enabled, stop the controller first before starting it.
// If a hot-restart is initiated, the controller won't be stopped, and because
// there is no way of knowing if a hot-restart has happened, we must assume
// every start is a hot-restart.
// every start is a hot-restart. Related issue:
// https://github.com/flutter/flutter/issues/10437
if (kDebugMode) {
final platformInterface = MobileScannerPlatform.instance;
if (MobileScannerPlatform.instance case final MethodChannelMobileScanner implementation) {
if (MobileScannerPlatform.instance
case final MethodChannelMobileScanner implementation) {
try {
await platformInterface.stop(force: true);
await implementation.stop(force: true);
} catch (e) {
// Don't do anything if the controller is already stopped.
debugPrint('$e');
... ...
... ... @@ -496,6 +496,10 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
}
private func releaseTexture() {
if (textureId == nil) {
return
}
registry.unregisterTexture(textureId)
textureId = nil
}
... ...