snackbar method

void snackbar(
  1. String text, {
  2. String? snackbarActionLabel,
  3. dynamic action()?,
})

Implementation

void snackbar(
  String text, {
  String? snackbarActionLabel,
  Function()? action,
}) {
  final snackBar = SnackBar(
    content: Text(text),
    action: snackbarActionLabel == null
        ? null
        : SnackBarAction(
            label: snackbarActionLabel,
            onPressed: () {
              if (action != null) action();
            }),
  );
  rootScaffoldMessengerKey.currentState!.showSnackBar(snackBar);
}