showToaster function Null safety

Future<bool> showToaster(
  1. {required String text,
  2. ToastDuration duration = ToastDuration.short,
  3. ToastGravity gravity = ToastGravity.bottom,
  4. BorderRadius borderRadius = const BorderRadius.all(Radius.circular(16)),
  5. Color backgroundColor = const Color(0xAA000000),
  6. Color fontColor = const Color(0xFFFFFFFF),
  7. TextAlign textAlign = TextAlign.center,
  8. EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 16),
  9. EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
  10. Border? border}
)

Implementation

Future<bool> showToaster({
  required String text,
  ToastDuration duration = ToastDuration.short,
  ToastGravity gravity = ToastGravity.bottom,
  BorderRadius borderRadius = const BorderRadius.all(Radius.circular(16)),
  Color backgroundColor = const Color(0xAA000000),
  Color fontColor = const Color(0xFFFFFFFF),
  TextAlign textAlign = TextAlign.center,
  EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 16),
  EdgeInsets padding = const EdgeInsets.symmetric(
    horizontal: 16,
    vertical: 12,
  ),
  Border? border,
}) async {
  ToastView.shared.dismiss();
  await ToastView.shared
      .create(
        text,
        gravity,
        border,
        borderRadius,
        backgroundColor,
        fontColor,
        textAlign,
        margin,
        padding,
      )
      .show(duration);
  return true;
}