mount static method

Widget mount({
  1. Key? key,
  2. required Widget child,
  3. ToastBuilder? toastBuilder,
})

mount the Toaster in the widget tree for reference later. Toaster uses an InheritedWidget, so all rules apply; a Toaster may be shadowed by a new Toaster, and the BuildContext used to refrence the Toaster must be in the same tree as the Toaster.

toastBuilder is used to build toasts; it takes a toast, as well as an animation used to coordinate the toast's animation in and out.

Implementation

static Widget mount(
    {Key? key, required Widget child, ToastBuilder? toastBuilder}) {
  return ToasterDisplay(
    toastBuilder: toastBuilder ??
        (toast, animation) => DefaultToast(
              toast: toast,
              animation: animation,
            ),
    child: child,
    key: key,
  );
}