import 'package:permission_handler/permission_handler.dart'; Future requestNotificationPermission() async { final status = await Permission.notification.request(); if (status.isGranted) { print("Notification permission granted!"); } else if (status.isDenied) { print("Notification permission denied."); // Optionally show a dialog or a snackbar explaining the importance of the permission } else if (status.isPermanentlyDenied) { print("Notification permission permanently denied."); // You can redirect the user to the app settings to change the permission manually openAppSettings(); } return status.isGranted; }