initialize method
Initialize and set up the notification controller.
Implementation
@override
Future<void> initialize() async {
tz.initializeTimeZones();
List<Permission> permissions =
List.from([Permission.notification, Permission.scheduleExactAlarm]);
var status = await permissions.request();
debug('$runtimeType - permissions: $status');
await FlutterLocalNotificationsPlugin().initialize(
const InitializationSettings(
android: AndroidInitializationSettings('app_icon'),
iOS: DarwinInitializationSettings(),
),
onDidReceiveBackgroundNotificationResponse:
onDidReceiveNotificationResponse,
onDidReceiveNotificationResponse: onDidReceiveNotificationResponse,
);
info('$runtimeType initialized.');
debug('$runtimeType - Pending Notifications:');
for (var notification in (await FlutterLocalNotificationsPlugin()
.pendingNotificationRequests())) {
debug(' - ${notification.title}');
}
}