41 lines
1.4 KiB
Dart
41 lines
1.4 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:intl/date_symbol_data_local.dart';
|
|
|
|
import 'src/app/app.dart';
|
|
import 'src/core/logging/app_logger.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// Глобальные обработчики ошибок — гарантируют, что НИ ОДНА ошибка
|
|
// (синхронная Flutter, asyncronous, native) не уйдёт молча.
|
|
FlutterError.onError = (FlutterErrorDetails details) {
|
|
AppLogger.error(
|
|
'FlutterError: ${details.exceptionAsString()}',
|
|
error: details.exception,
|
|
stackTrace: details.stack,
|
|
tag: details.library ?? 'flutter',
|
|
);
|
|
// Не подавляем штатное поведение Flutter (red-screen в debug,
|
|
// `dumpErrorToConsole` и т.п.) — оно по-прежнему срабатывает.
|
|
FlutterError.presentError(details);
|
|
};
|
|
|
|
PlatformDispatcher.instance.onError = (Object error, StackTrace stack) {
|
|
AppLogger.error(
|
|
'PlatformDispatcher uncaught: $error',
|
|
error: error,
|
|
stackTrace: stack,
|
|
tag: 'platform',
|
|
);
|
|
// true = ошибка обработана; иначе она «всплывёт» дальше.
|
|
return true;
|
|
};
|
|
|
|
await initializeDateFormatting('ru');
|
|
runApp(const ProviderScope(child: NewBudgetApp()));
|
|
}
|