Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/src/qr_code_scanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class QRView extends StatefulWidget {
}

class _QRViewState extends State<QRView> {
late MethodChannel _channel;
MethodChannel? _channel;
late LifecycleEventHandler _observer;

@override
Expand Down Expand Up @@ -87,9 +87,11 @@ class _QRViewState extends State<QRView> {
}

Future<void> updateDimensions() async {
await QRViewController.updateDimensions(
widget.key as GlobalKey<State<StatefulWidget>>, _channel,
overlay: widget.overlay);
if (_channel != null) {
await QRViewController.updateDimensions(
widget.key as GlobalKey<State<StatefulWidget>>, _channel!,
overlay: widget.overlay);
}
}

bool onNotification(notification) {
Expand Down Expand Up @@ -154,7 +156,7 @@ class _QRViewState extends State<QRView> {

// Start scan after creation of the view
final controller = QRViewController._(
_channel,
_channel!,
widget.key as GlobalKey<State<StatefulWidget>>?,
widget.onPermissionSet,
widget.cameraFacing)
Expand Down