Unable to create closable notifications

am trying to create notification that will stay open till a user closes it. unfortunately, no luck so far.
Tried using as follows
Notification.show(“test forever”, -1, Position.MIDDLE).addThemes(ValoTheme.NOTIFICATION_CLOSABLE, ValoTheme.NOTIFICATION_ERROR);

Do I need to include any extra package in my gradle build (version 14.1.7)??

I’m not sure how far the out-of-the-box closing functionality of Notifications go, but if the added theme doesn’t work, all you need to do is add your own close button in the Notification layout.

This is achieved by not using Notification::show to create your Notification instance, and instead you instantiate a new Notification yourself.

Notification notification = new Notification();
notification.add(new Button(VaadinIcon.CLOSE.create(), click -> notification.close()));
notification.add(new Text("test forever"));
notification.setDuration(-1);
notification.setPosition(Position.MIDDLE);
notification.addThemeVariants(NotificationVariant.LUMO_ERROR);
notification.open();

Thank you very much, that did it!