onNotification property Null safety
Called when a notification of the appropriate type arrives at this location in the tree.
Return true to cancel the notification bubbling. Return false (or null) to allow the notification to continue to be dispatched to further ancestors.
The notification's Notification.visitAncestor method is called for each ancestor, and invokes this callback as appropriate.
Notifications vary in terms of when they are dispatched. There are two main possibilities: dispatch between frames, and dispatch during layout.
For notifications that dispatch during layout, such as those that inherit from LayoutChangedNotification, it is too late to call State.setState in response to the notification (as layout is currently happening in a descendant, by definition, since notifications bubble up the tree). For widgets that depend on layout, consider a LayoutBuilder instead.
final NotificationListenerCallback<T>? onNotification;