toastification top-level property
This is the main singleton class instance of the package. You can use this instance to show and manage your notifications.
use show method to show a built-in notifications
example :
toastification.show(
context: context, // optional if ToastificationWrapper is in widget tree
alignment: Alignment.topRight,
title: Text('Hello World'),
description: Text('This is a notification'),
type: ToastificationType.info,
style: ToastificationStyle.flat,
autoCloseDuration: Duration(seconds: 3),
);
use showCustom method to show a custom notification
you should create your own widget and pass it to the builder parameter
example :
toastification.showCustom(
context: context, // optional if ToastificationWrapper is in widget tree
alignment: Alignment.topRight,
animationDuration: Duration(milliseconds: 500),
autoCloseDuration: Duration(seconds: 3),
builder: (context, item) {
return CustomToastWidget();
},
);
Implementation
final toastification = Toastification();