48 lines
1.4 KiB
Dart
48 lines
1.4 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:rogapp/features/landing/landing_page.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:rogapp/features/utils/error_reporter.dart';
|
|
|
|
void reportError(
|
|
ProviderContainer container, Object error, StackTrace stackTrace) {
|
|
// Log the error locally or report to a server
|
|
print('Caught an error: $error');
|
|
container.read(errorReportingProvider).reportError(error, stackTrace);
|
|
}
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
final container = ProviderContainer();
|
|
runZonedGuarded(() {
|
|
runApp(UncontrolledProviderScope(container: container, child: const App()));
|
|
FlutterError.onError = (FlutterErrorDetails details) {
|
|
final error = details.exception;
|
|
final stackTrace = details.stack ?? StackTrace.current;
|
|
reportError(container, error, stackTrace);
|
|
};
|
|
}, (error, stackTrace) {
|
|
reportError(container, error, stackTrace ?? StackTrace.current);
|
|
});
|
|
}
|
|
|
|
class App extends StatelessWidget {
|
|
const App({super.key});
|
|
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: const Color.fromARGB(255, 0, 35, 140)), //Samurai Blue
|
|
useMaterial3: true,
|
|
),
|
|
home: const LandingPage(),
|
|
);
|
|
}
|
|
}
|