attach method Null safety

  1. @override
void attach(
  1. ScrollPosition position
)
override

Register the given position with this controller.

After this function returns, the animateTo and jumpTo methods on this controller will manipulate the given position.

Implementation

@override
void attach(ScrollPosition position) {
  super.attach(position);
  assert(!_positionToListener.containsKey(position));
  _positionToListener[position] = () {
    _lastUpdated = position;
    _lastUpdatedOffset = position.pixels;
  };
  position.addListener(_positionToListener[position]!);
}