This commit is contained in:
petrovyuri
2025-01-21 14:24:31 +03:00
parent e7b2c31e86
commit 17d096baac
96 changed files with 3575 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
part of 'app_runner.dart';
/// Метод инициализации обработчиков ошибок
void _initErrorHandlers(IDebugService debugService) {
// Обработка ошибок в приложении
FlutterError.onError = (details) {
_showErrorScreen();
debugService.handleError(details.exception, details.stack,
'FlutterError.onError: ${details.exceptionAsString()}',);
};
// Обработка асинхронных ошибок в приложении
PlatformDispatcher.instance.onError = (error, stack) {
_showErrorScreen();
debugService.handleError(error, stack, 'PlatformDispatcher: $error');
return true;
};
}
/// Метод для показа экрана ошибки
void _showErrorScreen() {
WidgetsBinding.instance.addPostFrameCallback((_) {
AppRouter.rootNavigatorKey.currentState?.push(
MaterialPageRoute(
builder: (_) => const ErrorScreen(),
),
);
});
}