Logging Lifecycle eingebaut
This commit is contained in:
1 parent
cfbc0cf765
commit
32ec25af14
3 files changed
+40
-6
No files matched your search
+31
-6
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:is_lock_screen/is_lock_screen.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||
@@ -54,12 +55,8 @@ void _traceUncaughtExceptions(Object error, StackTrace stackTrace) {
|
||||
Util.logException('Stack-Trace: $stackTrace');
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
MyApp({super.key}) {
|
||||
MqttCore.setup();
|
||||
|
||||
_startLocationService();
|
||||
}
|
||||
class MyApp extends StatefulWidget {
|
||||
MyApp({super.key});
|
||||
|
||||
static late Isar isarInstance;
|
||||
|
||||
@@ -67,6 +64,34 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
static bool suppressAcceptDialog = false;
|
||||
|
||||
@override
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
MqttCore.setup();
|
||||
|
||||
_startLocationService();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) async {
|
||||
super.didChangeAppLifecycleState(state);
|
||||
Util.logInfo('Lifecylcle changes: $state');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
|
||||
@@ -768,6 +768,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
is_lock_screen:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: is_lock_screen
|
||||
sha256: "7f45c22b1bb4bd9849aa699bc45b5b9473ada262a4266e1d7d51babdf50c0c83"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
isar:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -70,6 +70,7 @@ dependencies:
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
package_info_plus: ^5.0.1
|
||||
device_info_plus: ^9.1.2
|
||||
is_lock_screen: ^2.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in new issue
Block a user