showSnackBar method

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showSnackBar(
  1. SnackBar snackBar, {
  2. void onClosed(
    1. SnackBarClosedReason
    )?,
  3. VoidCallback? onVisible,
})

Implementation

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showSnackBar(
  SnackBar snackBar, {
  void Function(SnackBarClosedReason)? onClosed,
  VoidCallback? onVisible,
}) {
  final controller = messenger.showSnackBar(snackBar);
  onVisible?.call();
  if (onClosed != null) {
    controller.closed.then((reason) => onClosed.call(reason));
  }
  return controller;
}