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.link
To create a local project with this code sample, run:
flutter create --sample=widgets.Notification.1 mysample
- ScrollNotification which describes the notification lifecycle.
- ScrollStartNotification which returns the start position of scrolling.
- ScrollEndNotification which returns the end position of scrolling.
- NestedScrollView which creates a nested scroll view.
Abstract const constructor. This constructor enables subclasses to provide
const constructors so that they can be used in const expressions.
- hashCode → int
The hash code for this object.
- runtimeType → Type
A representation of the runtime type of the object.
List< String>description) → void
- Add additional information to the given description for use by toString.
BuildContext? target) → void
- Start bubbling this notification at the given build context.
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
) → String
A string representation of this object.
Object other) → bool
The equality operator.