close abstract method
void
close()
Programmatically dismisses the toast notification.
Triggers the dismissal animation and removes the toast from the display stack. This method can be called multiple times safely - subsequent calls after dismissal will have no effect.
Example:
final toast = showToast(context: context, builder: (context, overlay) {
return AlertCard(
title: 'Auto-close',
trailing: IconButton(
icon: Icon(Icons.close),
onPressed: overlay.close,
),
);
});
// Close programmatically after delay
Timer(Duration(seconds: 2), toast.close);
Implementation
void close();