showSyncSnackBar function

dynamic showSyncSnackBar(
  1. SnackBar snackBar
)

Shows a SnackBar using the ScaffoldMessenger without requiring a BuildContext.

This function is useful for showing snack bars from anywhere in the app, even outside the widget tree.

Example:

showSyncSnackBar(SnackBar(content: Text('Hello, world!')));

Implementation

showSyncSnackBar(SnackBar snackBar) {
  ScaffoldMessenger.of(Utils.navigatorKey.currentContext!)
      .showSnackBar(snackBar);
}