fix(shopinbit): show manual customer key set errors as a dialog
What changed, and why it matters
This commit changes how an error message is shown to the user when saving a customer key in the ShopInBit settings. Instead of a temporary warning banner, it now shows a proper dialog box. It also adds a safety check to avoid a crash if the user navigates away while the dialog is open. There is no direct security vulnerability being fixed here; it is a UI/UX robustness improvement.
No security action required. Treat as a normal UI fix. If reviewing the broader ShopInBit key-management flow, separately audit how the customer key is generated, stored, and transmitted.
Security signals we found
UI error-handling hardening
Mounted-state guard added to prevent post-dispose setState crash
Evidence from the diff
The patch replaces showFloatingFlushBar with await showDialog<StackOkDialog> for error display during manual customer key setup in shopinbit_settings_view.dart. Because the dialog is now awaited, the widget may unmount before the finally block runs, so a mounted guard was added around setState(() => _loading = false). This prevents a common Flutter ‘setState() called after dispose()’ runtime exception. No cryptographic, authentication, or authorization logic is changed.
Changed components
lib/pages/shopinbit/shopinbit_settings_view.dartInspect captured patch +11 / −6
diff --git a/lib/pages/shopinbit/shopinbit_settings_view.dart b/lib/pages/shopinbit/shopinbit_settings_view.dart
index d9574f6..bb92bcd 100644
--- a/lib/pages/shopinbit/shopinbit_settings_view.dart
+++ b/lib/pages/shopinbit/shopinbit_settings_view.dart
@@ -166,16 +166,21 @@ class _ShopInBitSettingsViewState extends ConsumerState<ShopInBitSettingsView> {
}
} catch (e) {
if (mounted) {
- unawaited(
- showFloatingFlushBar(
- type: FlushBarType.warning,
- message: "Failed to set key: $e",
- context: context,
+ await showDialog<void>(
+ context: context,
+ useRootNavigator: Util.isDesktop,
+ builder: (context) => StackOkDialog(
+ title: "Failed to set key",
+ maxWidth: Util.isDesktop ? 500 : null,
+ message: e.toString(),
+ desktopPopRootNavigator: Util.isDesktop,
),
);
}
} finally {
- setState(() => _loading = false);
+ // Awaiting the error dialog above means the widget can unmount before
+ // we get here.
+ if (mounted) setState(() => _loading = false);
}
}
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.