Skip to content

Commit

Permalink
improve comparison to handle exception states
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamVe committed Sep 11, 2024
1 parent 3432835 commit 769aeda
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/app/views/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ class MainPage extends ConsumerWidget {
// If the current device changes, we need to pop any open dialogs.
ref.listen<AsyncValue<YubiKeyData>>(currentDeviceDataProvider,
(prev, next) {
final serial = next.value?.info.serial;
if ((serial != null && serial == prev?.value?.info.serial) ||
final serial = next.hasValue == true ? next.value?.info.serial : null;
final prevSerial =
prev?.hasValue == true ? prev?.value?.info.serial : null;
if ((serial != null && serial == prevSerial) ||
(next.hasValue && (prev != null && prev.isLoading))) {
return;
}
Expand Down

0 comments on commit 769aeda

Please sign in to comment.