mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 01:37:40 +00:00
Prevent multiple UI errors from showing multiple alerts [skip ci]
This commit is contained in:
parent
194902d8cb
commit
ae0f9df041
1 changed files with 10 additions and 2 deletions
|
@ -50,6 +50,7 @@ import 'package:cake_wallet/wallet_type_utils.dart';
|
|||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
final rootKey = GlobalKey<RootState>();
|
||||
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||
bool hasError = false;
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
|
@ -206,11 +207,16 @@ void _sendExceptionFile() async {
|
|||
}
|
||||
|
||||
void _onError(FlutterErrorDetails errorDetails) {
|
||||
if (hasError) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasError = true;
|
||||
_saveException(errorDetails.exception.toString(), errorDetails.stack);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(timeStamp) {
|
||||
showPopUp<void>(
|
||||
(timeStamp) async {
|
||||
await showPopUp<void>(
|
||||
context: navigatorKey.currentContext!,
|
||||
builder: (context) {
|
||||
return AlertWithTwoActions(
|
||||
|
@ -229,6 +235,8 @@ void _onError(FlutterErrorDetails errorDetails) {
|
|||
);
|
||||
},
|
||||
);
|
||||
|
||||
hasError = false;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue