cancelNotification method

Future<NotificationFailure?> cancelNotification(
  1. String id
)

Cancels a specific notification by ID. Tries both repositories to ensure cancellation.

Implementation

Future<NotificationFailure?> cancelNotification(String id) async {
  if (!_isInitialized) {
    return NotificationFailure.initialization(
      details: 'Notification manager not initialized',
    );
  }

  // Try to cancel from both repositories
  final NotificationFailure? localError = await _localRepository
      .cancelNotification(id);
  final NotificationFailure? firebaseError = await _firebaseRepository
      .cancelNotification(id);

  // Return the first error if any
  return localError ?? firebaseError;
}