cancelNotification method

Future<NotificationResult<void>> cancelNotification(
  1. int id
)

Cancels a local or scheduled notification with identifier id.

Implementation

Future<NotificationResult<void>> cancelNotification(int id) async {
  final failure = _precondition<void>();
  if (failure != null) return failure;
  if (_localEnabled && _scheduledEnabled) {
    return _factory!.cancelUseCase.call(id);
  }
  if (_localEnabled) return _factory!.localRepo.cancel(id);
  if (_scheduledEnabled) return _factory!.scheduledRepo.cancel(id);
  return const NotificationFailureResult(
    ProviderNotEnabledFailure('cancelNotification'),
  );
}