cancelNotification method
Cancels a specific notification by ID.
Implementation
Future<void> cancelNotification(int id) async {
if (!_initialized) {
throw StateError('NotificationService not initialized. Call initialize() first.');
}
try {
await _localNotifications!.cancel(id);
logi('Cancelled notification: $id');
} catch (e, stackTrace) {
loge(e, 'Error cancelling notification', stackTrace);
_onError?.call('Error cancelling notification: $e', stackTrace);
}
}