Called when a ScrollPosition is attached to the scroll controller.
Since a scroll position is not attached until a Scrollable is actually built, this can be used to respond to a new position being attached.
At the time that a scroll position is attached, the ScrollMetrics, such as the ScrollMetrics.maxScrollExtent, are not yet available. These are not determined until the Scrollable has finished laying out its contents and computing things like the full extent of that content. ScrollPosition.hasContentDimensions can be used to know when the metrics are available, or a ScrollMetricsNotification can be used, discussed further below.
To create a local project with this code sample, run:
flutter create --sample=widgets.ScrollController.onAttach.1 mysample
final ScrollControllerCallback? onAttach;