Notification class abstract
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
See also:
- 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.
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.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
debugFillDescription(
List< String> description) → void - Add additional information to the given description for use by toString.
-
dispatch(
BuildContext? target) → void - Start bubbling this notification at the given build context.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited