dismissSnackbar method
Dismisses a specific snackbar by its ID
This method searches through the snackbar queue for a snackbar matching the given ID and dismisses only that specific snackbar, preserving all other snackbars, dialogs, and bottom sheets.
Parameters:
id: The ID of the snackbar to dismiss (required)onDismissed: Optional callback executed after the snackbar is dismissed
Returns true if a snackbar with the given ID was found and dismissed,
false if no snackbar with that ID was found.
Example:
Modal.showSnackbar(text: 'Message', id: 'my_snack');
// Later...
await Modal.dismissSnackbar('my_snack');
Implementation
Future<bool> dismissSnackbar(String id, {VoidCallback? onDismissed}) async {
return await dismissById(id, onDismissed: onDismissed);
}