Skip to content
Merged
Prev Previous commit
Next Next commit
remove debug code
  • Loading branch information
denrase committed Oct 24, 2023
commit 40f86bc9ca275ed7d77f60b1e7d0a12fcc70725e
38 changes: 1 addition & 37 deletions flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,7 @@ class MyApp extends StatefulWidget {
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {

@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}

@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
class _MyAppState extends State<MyApp> {

@override
Widget build(BuildContext context) {
Expand All @@ -116,30 +104,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
),
);
}

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
if (state == AppLifecycleState.paused) {
print('App is going into the background');
Future.delayed(const Duration(seconds: 2), () async {
// This code will be executed 2 seconds after the app goes into the background
print('Trigger exception in background');
await _exceptionInBackground();
});
}
}

Future<void> _exceptionInBackground() async {
try {
throw Exception('_exceptionInBackground 2');
} catch (exception, stackTrace) {
await Sentry.captureException(
exception,
stackTrace: stackTrace,
);
}
}
}

class MainScaffold extends StatelessWidget {
Expand Down