close method
Close the snackbar with or without animation.
Uses Dart 3.8 pattern matching to handle different close behaviors based on whether animations are enabled.
Implementation
Future<void> close({bool withAnimations = true}) async =>
switch (withAnimations) {
// When animations are disabled, immediately remove the overlay
false => _removeOverlay(),
// When animations are enabled, trigger entry removal and wait for completion
true => () async {
_removeEntry();
await future;
}(),
};