From f11c7233d8d753938bfef05317279a0c8d3aadb2 Mon Sep 17 00:00:00 2001 From: Jens Pfahl Date: Thu, 8 Aug 2024 16:56:35 +0200 Subject: [PATCH] commit ignore wrong locations and go with UTC --- lib/service/LocalNotificationService.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/service/LocalNotificationService.dart b/lib/service/LocalNotificationService.dart index aa0033c..4736eec 100644 --- a/lib/service/LocalNotificationService.dart +++ b/lib/service/LocalNotificationService.dart @@ -119,9 +119,14 @@ class LocalNotificationService { InitializationSettings(android: initializationSettingsAndroid); tz.initializeTimeZones(); - final String currentTimeZone = await FlutterTimezone.getLocalTimezone(); - debugPrint("currentTimeZone=$currentTimeZone"); - tz.setLocalLocation(tz.getLocation(currentTimeZone)); + try { + final String currentTimeZone = await FlutterTimezone.getLocalTimezone(); + debugPrint("currentTimeZone=$currentTimeZone"); + tz.setLocalLocation(tz.getLocation(currentTimeZone)); + } catch (e) { + // ignore instead of failing + print(e); + } await _flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse response) async {