ToastrService class

Service to manage and display toastr notifications with security features.

This is the core service that handles displaying, positioning, and managing toast notifications. It uses a singleton pattern to maintain state across the application. Most users should use ToastrHelper instead of this service directly.

The service handles:

  • Overlay management for toast display
  • Animation control
  • Rate limiting and security validation
  • Duplicate prevention
  • Queue management for multiple toasts

Constructors

ToastrService()
Factory constructor that returns the singleton instance
factory

Properties

activeCount int
Get the number of currently active toastrs
no setter
hasActiveToastrs bool
Check if there are any active toastrs
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAll() → void
Clear all active toastrs
clearLast() → void
Clear the last (most recent) toastr
dispose() → void
Clean up resources and clear all active notifications
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show(ToastrConfig config, BuildContext context) → void
Show a toastr notification with the given configuration and context
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance ToastrService
Global instance for easy access
no setter