show method

void show(
  1. NiceToastItem toast
)

Implementation

void show(NiceToastItem toast) {
  setState(() {
    _toasts.insert(0, toast);
    if (_toasts.length > widget.maxVisible) {
      _toasts.removeLast();
    }
  });
  Future.delayed(toast.duration, () {
    if (mounted) setState(() => _toasts.removeWhere((t) => t.id == toast.id));
  });
}