Notification class Null safety

A notification that can bubble up the widget tree.

You can determine the type of a notification using the is operator to check the runtimeType of the notification.

To listen for notifications in a subtree, use a NotificationListener.

To send a notification, call dispatch on the notification you wish to send. The notification will be delivered to any NotificationListener widgets with the appropriate type parameters that are ancestors of the given BuildContext.

This example shows a NotificationListener widget that listens for ScrollNotification notifications. When a scroll event occurs in the NestedScrollView, this widget is notified. The events could be either a ScrollStartNotificationorScrollEndNotification.
To create a local project with this code sample, run:
flutter create --sample=widgets.Notification.1 mysample

See also:

Implementers

Constructors

Notification()
Abstract const constructor. This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
const

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

debugFillDescription(List<String> description) → void
Add additional information to the given description for use by toString.
mustCallSuper">@mustCallSuperprotected">@protected
dispatch(BuildContext? target) → void
Start bubbling this notification at the given build context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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