deleteChannel method

Future<void> deleteChannel(
  1. String channelId
)

Deletes a notification channel.

Note: On Android 8.0+, users must manually delete channels from system settings if they were previously created. This method only prevents future creation.

Implementation

Future<void> deleteChannel(String channelId) async {
  if (kIsWeb || !Platform.isAndroid) {
    return;
  }

  try {
    final androidPlugin =
        _plugin.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>();

    await androidPlugin?.deleteNotificationChannel(channelId);
    logd('Deleted notification channel: $channelId');
  } catch (e, stack) {
    loge(stack, 'Failed to delete channel $channelId: $e');
  }
}