showSnackBar static method
void
showSnackBar(
- String message, {
- Duration duration = const Duration(seconds: 4),
- SnackBarAction? action,
- Color? backgroundColor,
Show a snackbar using the stored context
Implementation
static void showSnackBar(
String message, {
Duration duration = const Duration(seconds: 4),
SnackBarAction? action,
Color? backgroundColor,
}) {
final ctx = context;
if (ctx == null) {
DebugLogger.log(
'[DependencyInjection] ⚠️ Cannot show snackbar: No context available',
);
return;
}
ScaffoldMessenger.of(ctx).showSnackBar(
SnackBar(
content: Text(message),
duration: duration,
action: action,
backgroundColor: backgroundColor,
),
);
}