import 'package:awesome_notifications/awesome_notifications.dart'; import 'package:flutter/material.dart'; class NotificationService { static Future initialize() async { await AwesomeNotifications().initialize( null, // icon untuk notifikasi [ NotificationChannel( channelKey: 'timer_channel', channelName: 'Timer Notifications', channelDescription: 'Notifikasi untuk timer pengering jagung', defaultColor: Colors.blue, ledColor: Colors.blue, importance: NotificationImportance.High, channelShowBadge: true, enableVibration: true, enableLights: true, ) ], ); // Request permission await AwesomeNotifications().isNotificationAllowed().then((isAllowed) async { if (!isAllowed) { await AwesomeNotifications().requestPermissionToSendNotifications(); } }); } static Future showNotification({ required String title, required String body, }) async { await AwesomeNotifications().createNotification( content: NotificationContent( id: 0, channelKey: 'timer_channel', title: title, body: body, notificationLayout: NotificationLayout.Default, ), ); } }